Multiple definitions of main() scenario

Souvik Roy
  • Souvik Roy

    Souvik Roy - 2010-07-01

    Hi everyone,
    I've just started with CppUnit this morning and stuck up in a problem. Basically I have a class interface defined in server.h and its definitions along with it's main() method in server.cpp. This file is in my top level of  hierarchy in my project and defines a global variable which is used in the other lower levels.
    I have created a few tests using CppUnit and added neccessary stuffs to my existing makefile , something like:

    bin_PROGRAMS=server tests
    tests_SOURCES=UnitTests/main.cpp UnitTests/FileNamesChecker.cpp server.cpp

    Now that naturally gives me a "Multiple Definitions of main()" error, as there UnitTest/main.cpp contains the main method for CppUnit and server.cpp contains the main method for the project. How can I run the test as a separate application ?


  • Souvik Roy

    Souvik Roy - 2010-07-01

    Edit: I wanna pull that off without disturbing the existing sources in the project.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks