[CMake] error: multiple declaration of main

Maik Beckmann beckmann.maik at googlemail.com
Wed Jan 28 05:44:59 EST 2009


Am Mittwoch 28 Januar 2009 schrieb ankit jain:
> hi all,
>
> in one of my folder i have three files. in each of them a main() function
> is defined. now on building it says that multiple declaration of main. if i
> compile the makefile using gcc only no such error had came.
> Guide me what to do?
>

I guess you did 
  add_executable(myapp source1.cpp source2.cpp source3.cpp)
What you want is
  add_executable(myapp1 source1.cpp)
  add_executable(myapp2 source2.cpp)
  add_executable(myapp3 source3.cpp)

HTH,
 -- Maik




More information about the CMake mailing list