Boost logo

Boost Users :

From: Ákos Maróy (akos_at_[hidden])
Date: 2008-08-18 09:00:26


Hi,

I'm trying to compile a simple unit test using the boost unit test
framework, using MS Visual Studio 2008. I can compile the same code on
Linux using gcc just fine (and on Windows using MiGW as well, actually).
But with Visual Studio, I get the following error:

------ Build started: Project: test, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
libboost_test_exec_monitor-vc90-mt-1_35.lib(test_main.obj) : error
LNK2019: unresolved external symbol "int __cdecl test_main(int,char * *
const)" (?test_main@@YAHHQAPAD_at_Z) referenced in function "public: void
__thiscall test_main_caller::operator()(void)"
(??Rtest_main_caller@@QAEXXZ)
C:\var\VS_workspace\Debug\test.exe : fatal error LNK1120: 1 unresolved
externals
Build log was saved at "file://c:\var\VS_workspace\test\Debug\BuildLog.htm"
test - 2 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

this is despite the fact that I'm linking against
libboost_test_exec_monitor-vc90-mt-1_35.lib, that would (?) include
test_main. here's the Visual C++ linking command parameter list:

/OUT:"C:\var\VS_workspace\Debug\test.exe" /INCREMENTAL /NOLOGO
/LIBPATH:"C:\usr\boost_1_35_0\lib" /MANIFEST
/MANIFESTFILE:"Debug\test.exe.intermediate.manifest"
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG
/PDB:"C:\var\VS_workspace\Debug\test.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE
/NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT
libboost_unit_test_framework-vc90-mt-1_35.lib
libboost_test_exec_monitor-vc90-mt-1_35.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

this unit test sample app I'm trying to work on is very simple:

#include <boost/test/unit_test.hpp>

using namespace boost::unit_test;

void test() {
        BOOST_CHECK(true);
}

test_suite *
init_unit_test_suite(int, char **) {
        test_suite *ts = BOOST_TEST_SUITE("Test");
        ts->add(BOOST_TEST_CASE(&test));
        framework::master_test_suite().add(ts);

        return 0;
}

I wonder what I'm doing wrong...

Akos


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