Having trouble with my first Boost Testing efforts

Posted on 2008-11-09
Last Modified: 2013-12-15
Hi all,

I'm having my first attempt at using the Boost Test API for generating unit tests for my C++ application.

I am running on Linux and developing with Eclipse.

I've put together a test file which unit tests a single code unit in my project and all works fine, my tests are run successfully. This test file defines a module, a sinngle test suite and a number of test cases.

Now I have come to wanting to test a second source unit in my project so I would like to introduce a second test file and this is where I'm having trouble.  In the second test file I have tried to define a second test module, a second test suite and a number of test cases.

When I build this code there are errors put out to my console indicating that I have "multiple defenitions of 'init_unit_test()' " and "multiple defenitions of 'main' " defined from the Boost Library.

I have found a work around to keep me going by putting the test cases from the second test file into the first test file as a new test suite but would really love to maintain the individual file approach per source unit being tested.

I look forward to reading and trying out your suggestions.
Question by:Zuzic
    1 Comment

    Accepted Solution

    No one can help me?

    I have figured it all out anyway :0)

    I have discovered that defining more than one test module was causing my problems.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Article by: Rob
    Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now