Linker warning LNK4217: locally defined symbol _ imported in function _

I'm building the below tiny boost app with the WDK (note that I'm
*not* building a driver or anything kernel-mode, just a regular
userland C++ app), but I'm getting the following errors when linking
with the boost libraries that I built earlier using bootstrap and
.\bjam (from the same terminal window). Anyone know what the problem
is, and how I might fix or work around it?
C:\exp>more exp.cpp
#pragma warning(disable: 4512)
#include ::~basic_stringbuf

OK, I learned about auto_link and the #pragma's in the headers that
automagically locate the correct .lib, but they aren't working. The
linker now complains about not being able to find
libboost_program_options-vc90-mt-s-1_40.lib, whereas I have only
*-vc100-* - strange, since I built boost from the exact same (Visual C
9.0) terminal window right before trying to build my app. The specific
error is:
LINK : fatal error LNK1104: cannot open file
'libboost_program_options-vc90-mt-s-1_40.lib'
Any ideas? Thanks in advance.
On Wed, Oct 14, 2009 at 5:40 PM, Yang Zhang
I'm building the below tiny boost app with the WDK (note that I'm *not* building a driver or anything kernel-mode, just a regular userland C++ app), but I'm getting the following errors when linking with the boost libraries that I built earlier using bootstrap and .\bjam (from the same terminal window). Anyone know what the problem is, and how I might fix or work around it?
C:\exp>more exp.cpp #pragma warning(disable: 4512) #include
int __cdecl main() { boost::program_options::options_description desc("Allowed options"); return 0; } C:\exp>more sources TARGETNAME=exp TARGETTYPE=PROGRAM
USE_MSVCRT=1 USE_STL=1 USE_NATIVE_EH=1
MSC_WARNING_LEVEL=/W4 /WX
_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
INCLUDES=..\boost_1_40_0
SOURCES=exp.cpp
UMTYPE=console UMBASE=0x400000
TARGETLIBS = $(SDK_LIB_PATH)\ws2_32.lib ..\boost_1_40_0\stage\lib\libboost_progr am_options-vc100-mt.lib
C:\exp>build BUILD: Compile and Link for x86 BUILD: Loading c:\winddk\7600.16385.0\build.dat... BUILD: Computing Include file dependencies: BUILD: Start time: Wed Oct 14 17:34:23 2009 BUILD: Examining c:\exp directory for files to compile. c:\exp Invalidating OACR warning log for 'root:x86chk' BUILD: Saving c:\winddk\7600.16385.0\build.dat... BUILD: Compiling and Linking c:\exp directory Configuring OACR for 'root:x86chk' - <OACR on> _NT_TARGET_VERSION SET TO WINXP Linking Executable - objchk_win7_x86\i386\exp.exe 1>errors in directory c:\exp 1>link : error LNK1218: warning treated as error; no output file generated BUILD: Finish time: Wed Oct 14 17:34:44 2009 BUILD: Done
1 executable built - 1 Warning - 1 Error
C:\exp>more *wrn 1>warnings in directory c:\exp 1>c:\exp\libboost_program_options-vc100-mt.lib(options_description.obj) : warning LNK4217: locally defined symbol ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ (public: virtual __thiscall std::basic_streambuf
::~basic_streambuf (void)) imported in function "public: virtual __thiscall std::basic_stringbuf ::~basic_stringbuf
(void)" (??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ) -- Yang Zhang http://www.mit.edu/~y_z/
-- Yang Zhang http://www.mit.edu/~y_z/

AMDG Yang Zhang wrote:
OK, I learned about auto_link and the #pragma's in the headers that automagically locate the correct .lib, but they aren't working. The linker now complains about not being able to find libboost_program_options-vc90-mt-s-1_40.lib, whereas I have only *-vc100-* - strange, since I built boost from the exact same (Visual C 9.0) terminal window right before trying to build my app. The specific error is:
LINK : fatal error LNK1104: cannot open file 'libboost_program_options-vc90-mt-s-1_40.lib'
Any ideas? Thanks in advance.
If you didn't specify a version of msvc when you built Boost, Boost.Build default to the most recent version it can find in the registry. It does not use your environment to determine which compiler to use. Try building with bjam ... toolset=msvc-9.0 In Christ, Steven Watanabe

On Sat, Oct 17, 2009 at 2:48 PM, Steven Watanabe
AMDG If you didn't specify a version of msvc when you built Boost, Boost.Build default to the most recent version it can find in the registry. It does not use your environment to determine which compiler to use. Try building with bjam ... toolset=msvc-9.0
Thanks much; with an additional --build-type=complete, everything worked. -- Yang Zhang http://www.mit.edu/~y_z/

OK, I learned about auto_link and the #pragma's in the headers that automagically locate the correct .lib, but they aren't working. The linker now complains about not being able to find libboost_program_options-vc90-mt-s-1_40.lib, whereas I have only *-vc100-* - strange, since I built boost from the exact same (Visual C 9.0) terminal window right before trying to build my app. The specific error is:
LINK : fatal error LNK1104: cannot open file 'libboost_program_options-vc90-mt-s-1_40.lib'
For msvc stuff, I usually manually copy the boost libs to project/solution build directory. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
participants (3)
-
Ray Burkholder
-
Steven Watanabe
-
Yang Zhang