我在編譯我編寫的程序時遇到問題。我有兩個不同的文件具有相同的包括但只有一個生成時使用g ++標準x86_64庫中的編譯問題
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':
/build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
collect2: ld returned 1 exit status
編譯下面的錯誤,我包括我的頭中的文件如下:
#include <google/sparse_hash_map>
using google::sparse_hash_map;
#include <ext/hash_map>
#include <math.h>
#include <iostream>
#include <queue>
#include <vector>
#include <stack>
using std::priority_queue;
using std::stack;
using std::vector;
using __gnu_cxx::hash_map;
using __gnu_cxx::hash;
using namespace std;
在網上搜索這兩條線沒有任何幫助我的東西。我會非常感謝任何建議。謝謝
你可以給我們提供完整的源代碼,或者至少在main()之前的幾行文件中編譯失敗嗎? – ivans 2010-05-25 20:11:13
嗨,謝謝你的提示。我遵循了你的一些建議,並意識到我不瞭解我編程的主要需求。以爲我可以編譯爲一個函數。似乎我有很多東西要學。 – user350282 2010-05-25 20:44:25