Methods prefixed by cdecl?
Hi,
I'm using Windows 7 (64 bit) and I'm trying to compile and link my
code against the regex libraries. It compiles fine, but at link time, it
can't find any of the methods in the regex library. But the methods it's
looking for are prefixed by "__cdecl". I've tried compiling my code with
the /Gd and /Gz options, and neither seemed to work.
Here's what the error looks like:
[ERROR] ResourceURI.obj : error LNK2019: unresolved external symbol
"private: class boost::basic_regex
::assign(char const *,char const *,unsigned int)) CB4 00000000 SECT40D notype () External | ?do_assign@?$basic_regex@DU?$regex_traits@DV?$w32_regex_traits@D@boost@@@boost@@@boost@@AAEAAV12@PBD0I@Z (private: class boost::basic_regex
> & __thiscall boost::basic_regex >::do_assign(char const *,char const *,unsigned int))
Any ideas on how to get my programs to link against the methods in the regex library? Thanks, Ven
I'm using Windows 7 (64 bit)
Do you compile for 64 bit? Boost and your application should be built for the same architecture.
But the methods it's looking for are prefixed by "__cdecl". I've tried compiling my code with the /Gd and /Gz options, and neither seemed to work.
/Gz is for stdcall, /Gd is for cdecl. If you do not specify either of them, then __thiscall is used for c++ member functions by default.
On Tue, Oct 19, 2010 at 6:36 PM, Igor R
Do you compile for 64 bit? Boost and your application should be built for the same architecture.
I'm not sure how relevant this is, but I found it interesting (from http://en.wikipedia.org/wiki/X86_calling_conventions) "Microsoft x64 calling convention... When compiling for the x64 architecture using Microsoft tools, there is only one calling convention — the one described here, so that stdcall, thiscall, cdecl, fastcall, etc., are now all one and the same."
I'm using Windows 7 (64 bit) and I'm trying to compile and link my code against the regex libraries. It compiles fine, but at link time, it can't find any of the methods in the regex library. But the methods it's looking for are prefixed by "__cdecl". I've tried compiling my code with the /Gd and /Gz options, and neither seemed to work.
Are you letting the auto-linking code select the correct regex .lib file to link against, or are you linking manually? I ask because those are the kinds of errors you may get if you select the wrong .lib to link to. HTH, John.
On 10/20/2010 03:37 AM, John Maddock wrote:
I'm using Windows 7 (64 bit) and I'm trying to compile and link my code against the regex libraries. It compiles fine, but at link time, it can't find any of the methods in the regex library. But the methods it's looking for are prefixed by "__cdecl". I've tried compiling my code with the /Gd and /Gz options, and neither seemed to work.
Are you letting the auto-linking code select the correct regex .lib file to link against, or are you linking manually?
I ask because those are the kinds of errors you may get if you select the wrong .lib to link to. I'm selecting the right .lib file - libboost_regex-vc100-mt-gd-1_38.lib. We're actually using Maven to build our project, and based on the debugging output, it's pulling the right library. This is the line we used to compile the boost libraries:
bjam toolset=msvc-10.0 variant=debug link=static threading=multi stage Are there other parameters that need to be specified?
HTH, John.
Thanks, Ven
On 10/20/2010 03:37 AM, John Maddock wrote:
I'm using Windows 7 (64 bit) and I'm trying to compile and link
against the regex libraries. It compiles fine, but at link time, it can't find any of the methods in the regex library. But the methods it's looking for are prefixed by "__cdecl". I've tried compiling my code with the /Gd and /Gz options, and neither seemed to work. Are you letting the auto-linking code select the correct regex .lib file to
my code link against, or are you linking manually?
I ask because those are the kinds of errors you may get if you select
wrong .lib to link to. I'm selecting the right .lib file -
On Wednesday, October 20, 2010 11:18 AM, Ven Tadipatri wrote: the libboost_regex-vc100-mt-gd-1_38.lib.
We're actually using Maven to build our project, and based on the debugging output, it's pulling the right library. This is the line we used to compile the boost libraries:
bjam toolset=msvc-10.0 variant=debug link=static threading=multi stage
Are there other parameters that need to be specified?
I see you are using a 64-bit build of Windows 7. Are you building a 64-bit program? If so, you need to add "address-model=64" to the bjam line. If you want to keep both 32-bit and 64-bit builds of boost, then also add "--stagedir=stage64" to keep the 32-bit and 64-bit libraries separate.
participants (5)
-
Andrew Holden
-
Igor R
-
John B. Turpish
-
John Maddock
-
Ven Tadipatri