我有以下代碼:編譯錯誤:未定義的符號: 「_main」,從引用:開始crt1.10.5.o
#include <iostream>
using namespace std;
class testing{
int test() const;
int test1(const testing& test2);
};
int testing::test() const{
return 1;
}
int testing::test1(const testing& test2){
test2.test();
return 1;
}
編譯後,它給了我下面的錯誤:
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
爲什麼它抱怨主要?我不能在另一個文件中聲明main幷包含這個文件嗎?
非常感謝!