Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:10:26+00:00 2026-06-18T01:10:26+00:00

I am trying to compile trivial unit test project in Visual Studio 2010. I

  • 0

I am trying to compile trivial unit test project in Visual Studio 2010. I have a testrunner.cpp:

#define BOOST_TEST_DYN_LINK

#define BOOST_TEST_MODULE "BaumWelch Unit Tests"
#include <boost/test/unit_test.hpp>

and exampletests.cpp

#include <boost/test/unit_test.hpp>

int add( int i, int j ) { return i+j; }

BOOST_AUTO_TEST_CASE( my_test )
{
  // seven ways to detect and report the same error:
  BOOST_CHECK( add( 2,2 ) == 4 );        // #1 continues on error
  BOOST_REQUIRE( add( 2,2 ) == 4 );      // #2 throws on error

  if( add( 2,2 ) != 4 )
     BOOST_ERROR( "Ouch..." );            // #3 continues on error

  if( add( 2,2 ) != 4 )
    BOOST_FAIL( "Ouch..." );             // #4 throws on error

  if( add( 2,2 ) != 4 ) throw "Ouch..."; // #5 throws on error

  BOOST_CHECK_MESSAGE( add( 2,2 ) == 4,  // #6 continues on error
    "add(..) result: " << add( 2,2 ) );
  BOOST_CHECK_EQUAL( add( 2,2 ), 4 );      // #7 continues on error
}

This example worked fine in Linux, however here it fails to compile:

1>------ Build started: Project: Test, Configuration: Release Win32 ------
1>Build started 30/01/2013 14:47:48.
1>InitializeBuildStatus:
1>  Touching "Release\Test.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>boost_unit_test_framework-vc100-mt-1_46_1.lib(boost_unit_test_framework-vc100-mt-1_46_1.dll) : error LNK2005: "class boost::unit_test::master_test_suite_t & __cdecl boost::unit_test::framework::master_test_suite(void)" (?master_test_suite@framework@unit_test@boost@@YAAAVmaster_test_suite_t@23@XZ) already defined in libboost_unit_test_framework-vc100-mt-1_46_1.lib(framework.obj)
1>MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
1>C:\Users\ga1009\Documents\dev\Oasis\Release\Test.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.

What am I doing wrong and how can I fix it?

EDIT: After applying the answer from Arne Mertz, I get:

1>------ Build started: Project: Test, Configuration: Release Win32 ------
1>Build started 30/01/2013 15:09:54.
1>InitializeBuildStatus:
1>  Touching "Release\Test.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>boost_unit_test_framework-vc100-mt-1_46_1.lib(boost_unit_test_framework-vc100-mt-1_46_1.dll) : error LNK2005: "class boost::unit_test::master_test_suite_t & __cdecl boost::unit_test::framework::master_test_suite(void)" (?master_test_suite@framework@unit_test@boost@@YAAAVmaster_test_suite_t@23@XZ) already defined in libboost_unit_test_framework-vc100-mt-1_46_1.lib(framework.obj)
1>C:\Users\ga1009\Documents\dev\Oasis\Release\Test.exe : fatal error LNK1169: one or more multiply defined symbols found
1>
1>Build FAILED.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:10:27+00:00Added an answer on June 18, 2026 at 1:10 am

    Check your project’s linker properties: There is a property System/SubSystem that should be set to /SUBSYSTEM:CONSOLE.

    Edit:
    For the multiple definition error it seems you have the following situation:
    In your testrunner.cpp, you define BOOST_TEST_DYN_LINK wich leads to a dynamic linking of boost_unit_test_framework-vc100-mt-1_46_1.dll which contains a definition of the master_test_suite function. In the other .cpp, you do NOT define that symbol, so that one gets linked statically against boost_unit_test_framework-vc100-mt-1_46_1.lib which, together with the dll gives two definitions.

    Solution: use the #define in every source before including the header.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to compile my project, that uses some third party headers, with mingw
I'm trying to compile a .cpp + .h file that includes newmat.h and tinyxml.h
Im trying to compile a simple class library project,its from Source Safe. However,when i
I'm trying to get this trivial parsec code to compile import Text.Parsec simple =
I have a trivial problem.. I am trying to modify a working Makefile to
When trying to compile a solution that contains a project with a reference to
Just trying to compile some trivial Haskell, but its not finding the c runtimes,
Trying to compile a unity3d project in xcode but i'm getting the following compile
I'm trying to compile a trivial command-line tool with XCode: #import <Cocoa/Cocoa.h> int main
Trying to compile a iPhone/iPad application with SDK3.2 and am getting this error: Undefined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.