Re: PCRE & MFC: problem with link error
- From: "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 12 Dec 2007 15:49:55 -0800
"Lynn Allan" <l_d_allan@xxxxxxxxxxxx> wrote in message
news:uMaeEhMPIHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your patient help as I wrestle with the linker/librarian
I got the linker to resolve the references with a pcre.def file that has
this contents:
LIBRARY pcre
EXPORTS
pcre_malloc
pcre_free
pcre_config
pcre_callout
pcre_compile
pcre_compile2
pcre_copy_substring
pcre_dfa_exec
pcre_exec
pcre_get_substring
pcre_get_stringnumber
pcre_get_substring_list
pcre_free_substring
pcre_free_substring_list
pcre_info
pcre_fullinfo
pcre_maketables
pcre_study
pcre_version
However, when I try to run the PcreTest.exe, I get an error message about
"missing pcre.dll".
My preference is to statically link the PcreTest.exe and not have to
distribute the pcre.dll.
In the settings for building pcre.lib, I specified:
Configuration Type: Static Library (.lib).
There are also preprocessor #define's for PCRE_STATIC
However, the generated Release\pcre.lib and Release\PcreTest.exe are much
smaller than expected, which would be the case if a .dll was required.
I looked though the build configuration settings for PcreTest.exe and
didn't see anywhere that pcre.dll was required. Is the above pcre.def
incorrect?
Here is a link to the vc6 project with source files. It has an Mfc project
and two console projects:
http://www.berbible.org/misc/pcre-74_071212b.zip
I have successfully built your source code so that the PcreText.exe uses the
static library. I had to change a few things:
1. PcreTest.dsw - Open the PcreTest.dsw in VC6. In FileView, select
"PcreTest files", then activate the Project |Dependencies menu item, and
make pcrelib a dependency. Not only will this cause the PcreTest.exe to be
rebuilt when anything in the library becomes out of date, it will also make
PcreTest link with the built Pcrelib.lib automatically.
2. PcreTest.dsp and PcreLib.dsp - in compiler defines, add PCRE_STATIC.
This is required so that both the library and the exe see prototypes of the
library functions as non-exported so link errors don't occur.
3. PcreTest.cpp - remove the line:
#pragma comment( lib,
"X:\\LdaFwApps\\BerBible\\Prototypes\\RegEx\\PcreVcProject\\Debug\\pcre.lib"
)
because the pcrelib.lib (and not any file called pcre.lib) will be
automatically linked due to change #1 above.
Please try this and I hope it gets you on your way. :-)
-- David
.
- Follow-Ups:
- Re: PCRE & MFC: problem with link error
- From: Lynn Allan
- Re: PCRE & MFC: problem with link error
- References:
- PCRE & MFC: problem with link error
- From: L.Allan
- Re: PCRE & MFC: problem with link error
- From: Giovanni Dicanio
- Re: PCRE & MFC: problem with link error
- From: Lynn Allan
- Re: PCRE & MFC: problem with link error
- From: David Ching
- Re: PCRE & MFC: problem with link error
- From: Lynn Allan
- Re: PCRE & MFC: problem with link error
- From: David Ching
- Re: PCRE & MFC: problem with link error
- From: Lynn Allan
- PCRE & MFC: problem with link error
- Prev by Date: Re: Howto find multiple servers using TCP
- Next by Date: Re: unresolved external symbol _wWinMainCRTStartup
- Previous by thread: Re: PCRE & MFC: problem with link error
- Next by thread: Re: PCRE & MFC: problem with link error
- Index(es):
Relevant Pages
|