Problem with Boost.Test (1.36.0) and Visual Studio 2008 SP1
Hi, I'm trying to build a test suite that worked with Linux and an older Boost version (1.34.1). I tried to compile it with Visual Studio 2008 SP1 with Boost 1.36 and I ran into this error : link /nologo /OUT:IRT_test_suit.exe /LIBPATH:D:\Travail\boost_1_36_0\lib "/LIBPA TH:D:\Python 2.5\libs" /LIBPATH:. IRT.lib boost_unit_test_framework-vc90-mt-1_36 .lib tools\boost_main_test.obj test_light.obj boost_unit_test_framework-vc90-mt-1_36.lib(boost_unit_test_framework-vc90-mt-1_3 6.dll) : error LNK2005: "public: static class boost::unit_test::unit_test_log_t & __cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>:: instance(void)" (?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_t est@boost@@SAAAVunit_test_log_t@23@XZ) déjà défini(e) dans test_light.obj IRT_test_suit.exe : fatal error LNK1169: un ou plusieurs symboles définis à diff érentes reprises ont été rencontrés boost_main_test.cpp consists of: #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "IRT test suit" #include <boost/test/unit_test.hpp> And test_light.cpp: #include <boost/test/unit_test.hpp> Both files were compiled with the arguments cl /nologo /EHsc /Ox /MD -D_CRT_SECURE_NO_DEPRECATE -DWIN32 /TP /ID:\Travail\boo st_1_36_0 /I. /c test_light.cpp /Fotest_light.obj I didn't find a thing on the Internet with this issue, so I hope someone will have a clue... Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
Hi again, Nobody has a clue on this matter ? Anyone uses Boost 1.36 with multiple files with Visual Studio 2008 ? Matthieu 2008/8/28 Matthieu Brucher <matthieu.brucher@gmail.com>:
Hi,
I'm trying to build a test suite that worked with Linux and an older Boost version (1.34.1). I tried to compile it with Visual Studio 2008 SP1 with Boost 1.36 and I ran into this error : link /nologo /OUT:IRT_test_suit.exe /LIBPATH:D:\Travail\boost_1_36_0\lib "/LIBPA TH:D:\Python 2.5\libs" /LIBPATH:. IRT.lib boost_unit_test_framework-vc90-mt-1_36 .lib tools\boost_main_test.obj test_light.obj boost_unit_test_framework-vc90-mt-1_36.lib(boost_unit_test_framework-vc90-mt-1_3 6.dll) : error LNK2005: "public: static class boost::unit_test::unit_test_log_t & __cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>:: instance(void)" (?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_t est@boost@@SAAAVunit_test_log_t@23@XZ) déjà défini(e) dans test_light.obj IRT_test_suit.exe : fatal error LNK1169: un ou plusieurs symboles définis à diff érentes reprises ont été rencontrés
boost_main_test.cpp consists of: #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "IRT test suit" #include <boost/test/unit_test.hpp>
And test_light.cpp: #include <boost/test/unit_test.hpp>
Both files were compiled with the arguments cl /nologo /EHsc /Ox /MD -D_CRT_SECURE_NO_DEPRECATE -DWIN32 /TP /ID:\Travail\boo st_1_36_0 /I. /c test_light.cpp /Fotest_light.obj
I didn't find a thing on the Internet with this issue, so I hope someone will have a clue...
Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
-- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
Hi, Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ? On a side note, there is no multi-file Boost.Test example. Matthieu 2008/8/30 Matthieu Brucher <matthieu.brucher@gmail.com>:
Hi again,
Nobody has a clue on this matter ? Anyone uses Boost 1.36 with multiple files with Visual Studio 2008 ?
Matthieu
2008/8/28 Matthieu Brucher <matthieu.brucher@gmail.com>:
Hi,
I'm trying to build a test suite that worked with Linux and an older Boost version (1.34.1). I tried to compile it with Visual Studio 2008 SP1 with Boost 1.36 and I ran into this error : link /nologo /OUT:IRT_test_suit.exe /LIBPATH:D:\Travail\boost_1_36_0\lib "/LIBPA TH:D:\Python 2.5\libs" /LIBPATH:. IRT.lib boost_unit_test_framework-vc90-mt-1_36 .lib tools\boost_main_test.obj test_light.obj boost_unit_test_framework-vc90-mt-1_36.lib(boost_unit_test_framework-vc90-mt-1_3 6.dll) : error LNK2005: "public: static class boost::unit_test::unit_test_log_t & __cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>:: instance(void)" (?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_t est@boost@@SAAAVunit_test_log_t@23@XZ) déjà défini(e) dans test_light.obj IRT_test_suit.exe : fatal error LNK1169: un ou plusieurs symboles définis à diff érentes reprises ont été rencontrés
boost_main_test.cpp consists of: #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "IRT test suit" #include <boost/test/unit_test.hpp>
And test_light.cpp: #include <boost/test/unit_test.hpp>
Both files were compiled with the arguments cl /nologo /EHsc /Ox /MD -D_CRT_SECURE_NO_DEPRECATE -DWIN32 /TP /ID:\Travail\boo st_1_36_0 /I. /c test_light.cpp /Fotest_light.obj
I didn't find a thing on the Internet with this issue, so I hope someone will have a clue...
Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
-- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
-- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
On Aug 30, 2008, at 2:33 PM, Matthieu Brucher wrote:
Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ?
On a side note, there is no multi-file Boost.Test example.
Look at my MD5 code in the sandbox SVN, <http://svn.boost.org/trac/ boost/browser/sandbox/md5/libs/coding/test>, for tests the span multiple files. (The three MD5-related test files are supposed to be compiled together. The Adler-32 test file is separate.)
2008/8/30 Matthieu Brucher <matthieu.brucher@gmail.com>:
Nobody has a clue on this matter ? Anyone uses Boost 1.36 with multiple files with Visual Studio 2008 ?
2008/8/28 Matthieu Brucher <matthieu.brucher@gmail.com>:
I'm trying to build a test suite that worked with Linux and an older Boost version (1.34.1). I tried to compile it with Visual Studio 2008 SP1 with Boost 1.36 and I ran into this error : link /nologo /OUT:IRT_test_suit.exe /LIBPATH:D:\Travail \boost_1_36_0\lib "/LIBPA TH:D:\Python 2.5\libs" /LIBPATH:. IRT.lib boost_unit_test_framework-vc90-mt-1_36 .lib tools\boost_main_test.obj test_light.obj boost_unit_test_framework-vc90-mt-1_36.lib (boost_unit_test_framework-vc90-mt-1_3 6.dll) : error LNK2005: "public: static class boost::unit_test::unit_test_log_t & __cdecl boost::unit_test::singleton<class boost::unit_test::unit_test_log_t>:: instance(void)" (?instance@? $singleton@Vunit_test_log_t@unit_test@boost@@@unit_t est@boost@@SAAAVunit_test_log_t@23@XZ) déjà défini(e) dans test_light.obj IRT_test_suit.exe : fatal error LNK1169: un ou plusieurs symboles définis à diff érentes reprises ont été rencontrés
boost_main_test.cpp consists of: #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "IRT test suit" #include <boost/test/unit_test.hpp>
And test_light.cpp: #include <boost/test/unit_test.hpp>
Both files were compiled with the arguments cl /nologo /EHsc /Ox /MD -D_CRT_SECURE_NO_DEPRECATE -DWIN32 /TP /ID:\Travail\boo st_1_36_0 /I. /c test_light.cpp /Fotest_light.obj
I didn't find a thing on the Internet with this issue, so I hope someone will have a clue...
Did you make sure that the BOOST_TEST_DYN_LINK and BOOST_TEST_MODULE macros are the current names? All sorts of names within Boost.Test have changed over the years, so make sure you're up to date when upgrading your Boost setup. Also, the list of mandatory source files has changed over the years, so make sure your upgraded project file isn't missing a source file that was added since boost 1.34.1. (Look in "BOOST_ROOT/libs/test/src" for the files, and "BOOST_ROOT/libs/ test/build/Jamfile.v2" to see the lists of which sub-libraries use which source files. You need to look at the unit-test sub-library's list.) -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
2008/9/1 Daryle Walker <darylew@hotmail.com>:
On Aug 30, 2008, at 2:33 PM, Matthieu Brucher wrote:
Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ?
On a side note, there is no multi-file Boost.Test example.
Look at my MD5 code in the sandbox SVN, <http://svn.boost.org/trac/boost/browser/sandbox/md5/libs/coding/test>, for tests the span multiple files. (The three MD5-related test files are supposed to be compiled together. The Adler-32 test file is separate.)
Thanks, I'll try that right away.
Did you make sure that the BOOST_TEST_DYN_LINK and BOOST_TEST_MODULE macros are the current names?
I think so, I found them in the documentation. But the error occurs without them as well (although it obviously complains about the missing main() function). All sorts of names within Boost.Test have changed
over the years, so make sure you're up to date when upgrading your Boost setup. Also, the list of mandatory source files has changed over the years, so make sure your upgraded project file isn't missing a source file that was added since boost 1.34.1. (Look in "BOOST_ROOT/libs/test/src" for the files, and "BOOST_ROOT/libs/test/build/Jamfile.v2" to see the lists of which sub-libraries use which source files. You need to look at the unit-test sub-library's list.)
I've used bjam to compile Boost, so there should not be any missing file. Besides, there are too many functions with the same name, not not enough. Thanks for the answer, I was becoming desperate ! Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
2008/9/1 Matthieu Brucher <matthieu.brucher@gmail.com>:
2008/9/1 Daryle Walker <darylew@hotmail.com>:
On Aug 30, 2008, at 2:33 PM, Matthieu Brucher wrote:
Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ?
On a side note, there is no multi-file Boost.Test example.
Look at my MD5 code in the sandbox SVN, <http://svn.boost.org/trac/boost/browser/sandbox/md5/libs/coding/test>, for tests the span multiple files. (The three MD5-related test files are supposed to be compiled together. The Adler-32 test file is separate.)
Thanks, I'll try that right away.
Thanks to your code, I found that I didn't declare BOOST_TEST_DYN_LINK for all my files, which resulted in the error I got. Now that I'm defining it for the whole test suite, it works (this should be written in big red letters int he documentation). Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
On Sep 1, 2008, at 4:18 PM, Matthieu Brucher wrote: [SNIP]
Thanks to your code, I found that I didn't declare BOOST_TEST_DYN_LINK for all my files, which resulted in the error I got. Now that I'm defining it for the whole test suite, it works (this should be written in big red letters int he documentation).
Is that from the Jamfile.v2 in that directory? I use an Xcode project file directly; the Jamfile is just a placeholder and has NOT been tested! So don't use it as the basis for your own set up. (I got suspicious by seeing "DYN" in your response since my Xcode project grabs a static, not dynamic, version of Boost.Test-UnitTest from a referenced project file.) -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
Matthieu Brucher <matthieu.brucher <at> gmail.com> writes:
Hi,
Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ?
It would help if you translate the error message. Can you clarify again with object files have conflicts? singleton<T>::instance is static method of the template defined in header file. Should be resolved by compiler. I don't have an access to this compiler at the moment, so can't reproduce this.
On a side note, there is no multi-file Boost.Test example.
There is one: unit_test_example_09 Gennadiy
Meanwhile, I investigated the matter a little further. This symbole is defined in the Boost unit test framework library, so it should have been included in the object file. May it be a Visual Studio issue ? Was Boost 1.36 tested with Visual Studio 2008 SP1 ?
It would help if you translate the error message. Can you clarify again with object files have conflicts?
Every file has the issue if BOOST_TEST_DYN_LINK is not defined for the file.
singleton<T>::instance is static method of the template defined in header file. Should be resolved by compiler.
That is what I thought as well.
I don't have an access to this compiler at the moment, so can't reproduce this.
On a side note, there is no multi-file Boost.Test example.
There is one: unit_test_example_09
Sorry I missed that one, although I tried to check every one. On a side note, BOOST_TEST_MAIN must be defined so that the main() function is instanciated, BOOST_TEST_MODULE is not enough (one could think so, and I did, reading the content of test_example_09_2.cpp Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher
participants (3)
-
Daryle Walker
-
Gennaidy Rozental
-
Matthieu Brucher