Jump to content
  • Advertisement
Sign in to follow this  
hymerman

Linker error when using boost

This topic is 4236 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folks, I'm getting an odd error that I can't explain (or fix) when building my program. Usually I use MSVC, and add the boost directory to the include path, then simply #include whatever boost library I need. That usually works fine, but now I'm building using SCons, through the command line, and things are going pear-shaped. I've set the include path to the boost directory again, as well as the libpath, and I know this is working since it doesn't complain about not being able to find header files during compilation. What doesn't work is linking; I'm getting unresolved external symbol errors for all the boost functons and classes I use, which is odd because I was under the impression that the header files contain all that I need... anyone else had the same experience? Better still, do any of you know how to fix this?

Share this post


Link to post
Share on other sites
Advertisement
Some things in Boost you can use just with the headers, such as their very handy smart pointer classes. Other things you'll need to build as a lib before using and linking. such as their very handy signal/slot architecture or threading libraries.

Also the headers mandate a particular library version ie 1_33 or 1_34,etc. If you build against a certain set of headers you must link with libraries built using those headers not a newer or older version.

Cheers
Chris

Share this post


Link to post
Share on other sites
Yeah, that's the problem - I'm only using things that don't need to be built, yet they're not linking correctly. At the moment, it's just shared_ptr, so I really don't know what could be causing the error. The actual error makes reference to boost::throw_exception, which I guess is used by shared_ptr, though if it's never given me any trouble before why suddently start now?

Share this post


Link to post
Share on other sites
I've solved the problem, though unfortunately the solution isn't going to be of any use to anyone - I'm only posting to prevent people wasting their time trying to help me!

Basically, I was linking in another static library that used boost, that I'd neglected to compile with support for exceptions. This only threw warnings, not errors, and when linked in with my main application (which called a function from the library), generated linker errors complaining that the code for boost's exceptions wasn't present. So, I'm compiling everything with the -EHsc flag set, and it's working fine and dandy.

Thanks for your help anyway, chollida1!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!