Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Test] Linker chooses “wrong” main function
From: Adi Shavit (adishavit_at_[hidden])
Date: 2012-08-28 14:20:23


Hi,

  I have a really strange problem.

When using Boost.Test, there is generally no need to define a main()
function, since Boost.Test provides one itself.
I recently had to convert my project to use static linking of 3rd party
libraries (on VS2010). Naturally, I had to link to multiple .libs so that
the build succeeds, and my build ran just fine.

However, when I ran my test project, something really strange happened. It
seems that one of the 3rd party .libs (libpng), required by one of my
dependent libraries, contained a test file with a main() function defined
within (pngtest.c).
Since my project did not have a main() function, The linker chose that one
as my "test" application. Thus, non of my tests run.

Does anyone know how I prevent this from happening?
How can I tell the linker/compiler to use the Boost.Test main()?

Thanks,
Adi



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net