I get an undefined link to the main error - although I defined main and (AFAICT), I linked it correctly. Here is my code and the commands I used:
// //proj1.h
Here is the console output:
$ g++ -isystem -pthread -c ${SOURCE_DIR}/proj1.c -o ${SOURCE_DIR}/proj1.o $ g++ -o ${SOURCE_DIR}/mytest ${SOURCE_DIR}/*.o -L${GTEST_DIR} libgtest.a /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status
Why is the main() function not found by the linker?
source share