Menu

Multiple definitions of main() scenario

Help
Souvik Roy
2010-07-01
2013-04-22
  • 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 ?

    Thanks
    Souvik

     
  • 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.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.