내용 이게 전분데


#include <stdio.h> #ifdef __cplusplus extern "C" { #endif int main(int argc, char* argv[]) { printf("Test completed\n"); } #ifdef __cplusplus } #endif


꼴받게 undefined reference to main 이러고 에러 뜬다


/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status


main에 저 지랄 나는 거 보니까 라이브러리랑 링크 문제가 있진 않아 보이는데


파일 구성은 이러함


CMakeLists.txt ├── include ├── src └── test ├── CMakeLists.txt └── test.cc


최상위 CMakeLists.txt 에서


enable_testing() add_subdirectory(test)


하고 test에 있는 CMakeLists.txt 에서 add_test 하는 건데 왜 안될까