Compile error: Undefined symbols: “_main”, referenced from: start in crt1.10.5.o

前端 未结 3 1244
既然无缘
既然无缘 2021-02-07 04:06

I have the following code:

#include 

using namespace std;

class testing{
   int test() const;
   int test1(const testing& test2);
};

int t         


        
3条回答
  •  执念已碎
    2021-02-07 04:49

    If you declare the main function in another file, then you must compile the two files separately, and then link them into 1 executable.

    Unless you include the entire contents of the file from the file with the main function, that will work too, though a bit odd. But, if you do this then you have to make sure that you compile the file which has the main() function.

提交回复
热议问题