- 論壇徽章:
- 0
|
本帖最后由 ianxia 于 2012-02-22 14:22 編輯
長期只接觸c#,突然接到任務(wù)要在linux平臺下做些開發(fā),環(huán)境不太適應(yīng),撿起學(xué)校里用的c++,發(fā)現(xiàn)了好多問題請高手解答
我用的系統(tǒng)redhat AS 5.6
1、gcc頭文件在那個(gè)目錄下。
2、linux的c++有沒有好的幫助文件和工具書,幫忙推薦下
3、有沒有比較高效的開發(fā)工具,VS用習(xí)慣了,直接使用vi編輯代碼感覺好痛苦。
寫了一段簡單代碼,編譯竟然一大堆錯(cuò)誤。
- #include<fstream>
- #include<iostream>
- using namespace std;
- int main ()
- {
- ofstream examplefile ("example.txt",ios::out);
- if (examplefile.is_open())
- {
- examplefile << "This is a line.\n";
- examplefile << "This is another line.\n";
- examplefile.close();
- }
- return 0;
- }
復(fù)制代碼 [root@localhost project]# gcc OpFile.cc
/tmp/ccOuwr7B.o: In function `__static_initialization_and_destruction_0(int, int)':
OpFile.cc .text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccOuwr7B.o: In function `__tcf_0':
OpFile.cc .text+0x6c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccOuwr7B.o: In function `main':
OpFile.cc .text+0xa1): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(char const*, std::_Ios_Openmode)'
OpFile.cc .text+0xaf): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::is_open()'
OpFile.cc .text+0xc9): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
OpFile.cc .text+0xdf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std: perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
OpFile.cc .text+0xed): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::close()'
OpFile.cc .text+0x100): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream()'
OpFile.cc .text+0x122): undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream()'
/tmp/ccOuwr7B.o .eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
|
|