Note that there are some explanatory texts on larger screens.

plurals
  1. POLinking to boost through SConstruct
    primarykey
    data
    text
    <p>I'm trying to work on a cross-platform project that uses boost for the file/directory operations. I've been using visual studio, but in order to compile on linux, I've decided to switch to SConstruct.</p> <p>I cannot [correctly?] link to the filesystem library however.</p> <p>my SConstruct file is as follow:</p> <pre><code>vLibs = [ 'libboost_system-vc100-mt-1_44.lib', 'libboost_filesystem-vc100-mt-1_44.lib']; # LIBS=vLibs, env = Environment(); env.AppendUnique(CXXFLAGS=Split("/EHsc")); env.Append(CPPPATH = ["C:\\Program Files (x86)\\boost\\boost_1_44"]); env.Append(LIBPATH = ["C:\\Program Files (x86)\\boost\\boost_1_44\\lib"]); env.Program( Glob('test.cpp'),LIBS=vLibs) </code></pre> <p>I keep getting errors like</p> <blockquote> <p>test.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const &amp; __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ)</p> </blockquote> <p>If I use visual studio, I get similar errors:</p> <blockquote> <p>Error 2 error LNK2001: unresolved external symbol "class boost::system::error_category const &amp; __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) T:\VS\temp\test.obj temp</p> </blockquote> <p>Until I add the libraries to the project, after which the errors go away and it compiles fine (in visual studio not SConstruct). </p> <p>I've tried every combination of the libraries (shared/unshared/runtime-shared/runtime-unshared/debug), but I always get the same errors. </p> <p>I've been searching for an answer for the last 6+ hours, so I'm grateful for any help.</p> <p>NOTE: I'm not using autolinking (#define BOOST_ALL_NO_LIB) because gcc doesn't support it)</p> <p>Here's the output of Scons:</p> <pre><code>scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... link /nologo /OUT:build\test.exe "/LIBPATH:C:\Program Files (x86)\boost\boost_1_44\lib" libboost_system-vc100-mt-1_44.lib libboost_filesystem-vc100-mt-1_44.lib build\test.obj test.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const &amp; __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (?? __Eposix_category@system@boost@@YAXXZ) test.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const &amp; __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (?? __Enative_ecat@system@boost@@YAXXZ) build\test.exe : fatal error LNK1120: 2 unresolved externals scons: *** [build\test.exe] Error 1120 scons: building terminated because of errors. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload