[CMake] about Linking CXX executable main fail

Rolf Eike Beer eike at sf-mail.de
Mon Jan 24 05:42:20 EST 2011


> ADD_EXECUTABLE(main .)

> Linking CXX executable main
> /usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o: In function
> `_start':
> (.text+0x20): undefined reference to `main'
> collect2: ld returned 1 exit status
> make[2]: *** [main] Error 1
> make[1]: *** [CMakeFiles/main.dir/all] Error 2
> make: *** [all] Error 2
> 
> i have main.c at .

But you have not told CMake it should put it main.c into the executable!

ADD_EXECUTABLE(main main.c)

I'm also not sure what you do with all those INCLUDE() and AUX_* stuff. You probably got something totally wrong about how CMake works.

Eike


More information about the CMake mailing list