我想出瞭如何在編譯時讓GNU的正確和當前版本成爲目標。如何讓我的IDE提供C++庫?
現在每當我嘗試編譯..我得到噸,我假設與C++庫有關的錯誤。我目前在我的MacBook上使用最新版本的Mountain Lion上的NetBeans最新版本。
的NetBeans顯示了線下一條紅線:
#include <random>
說,它無法找到包含文件。
我可能會收到50行錯誤。我認爲這是因爲它無法檢測C++中包含的庫/頭文件?下面是錯誤消息的一部分
main.cpp:46:31: error: no matching function for call to 'getline(std::ofstream&)'
main.cpp:46:31: note: candidates are:
In file included from /usr/include/wchar.h:114:0,
from /opt/local/include/gcc47/c++/cwchar:46,
from /opt/local/include/gcc47/c++/bits/postypes.h:42,
from /opt/local/include/gcc47/c++/iosfwd:42,
from /opt/local/include/gcc47/c++/ios:39,
from /opt/local/include/gcc47/c++/ostream:40,
from /opt/local/include/gcc47/c++/iostream:40,
from main.cpp:9:
/usr/include/stdio.h:449:9: note: ssize_t getline(char**, size_t*, FILE*)
/usr/include/stdio.h:449:9: note: candidate expects 3 arguments, 1 provided
In file included from /opt/local/include/gcc47/c++/string:54:0,
我右鍵單擊項目文件夾,然後點擊 「運行」,這讓我這個錯誤:
Undefined symbols for architecture x86_64:
「的std :: __ 1 :: basic_string的,性病:: __1 :: basic_string,std :: __ 1 :: allocator>,std :: __ 1 :: basic_string,__1 :: allocator> :: compare(char const *)const「,引用來自: Ammunition :: setElementData(std :: __ 1 :: basic_string, std :: __ 1 :: basic_string,std :: __ 1 :: allocator>,std :: __ 1 :: basic_string,std :: __ 1 :: std :: std :: std :: std :: std :: std :: std :: std :: std :: std :: std :: std :: _d ::分配器>)在Armor.o Consumable :: setElementData(std :: __ 1 :: basic_string,std :: __ 1 :: allocator>,std :: __ 1 :: basic_string,std :: __ 1 :: allocator>)in Consumable.o Creature :: setElementData( std :: __ 1 :: basic_string,std :: __ 1 :: allocator>,std :: __ 1 :: basic_string,std :: __ 1 :: allocator>)在Creature.o中 Entity :: setElementData(std :: __ 1 :: basic_string,std :: __ 1 :: allocator>,std :: __ 1 :: basic_string,std :: __ 1 :: allocator>)in Entity.o Item :: setElementData(std :: __ 1 :: basic_string,std :: __ 1 :: stdio :: :: allocator>,std :: __ 1 :: basic_string,std :: __ 1 :: allocator>)in Item.o parseElement(std :: __ 1 :: basic_istream> &,std :: __ 1 :: vector> &,XMLSerializable *)in parser.o ... 「std :: _ 1 :: _vector_base_common :: __ throw_length_error()常量」,從引用:在Creature.o 的std :: _ 1 ::矢量> _ ZNSt3 _16vectorIP4ItemNS_9allocatorIS2_EEE6assignIPS2_EENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ ::分配(無符號長整數)在Creature.o 空隙的std :: _1 ::向量,標準:: __ 1 :: allocator>,std :: __ 1 :: allocator,std :: __ 1 :: allocator>>> :: __ push_back_slow_path,std :: __ 1 :: allocator> const &>(std :: __ 1 :: basic_string,的std :: __ 1 ::分配器>在Entity.o常量&) 空隙的std :: _ 1 ::矢量> :: _push_back_slow_path(XMLSerializable *在parser.o常量&) 空隙的std :: _ 1 :: vector> :: _push_back_slow_path(Creature * const &)in CreatureFactory.o std :: _ 1 :: vector,std :: __ 1 :: allocator>,std :: __ 1 :: allocator,std :: __1 ::分配器>>> ::分配(無符號長整數)在CreatureFactory.o 的std :: _1 ::矢量> :: __追加(無符號長,瓷磚常量&)在DungeonLevel.o ...
你知道這是爲什麼發生嗎?它甚至與圖書館有關嗎?
從錯誤開始處開始。 main.cpp的第46行是什麼? – 2013-04-29 04:07:08
這實際上是一個空行 – Habit 2013-04-29 04:10:07
我右鍵單擊項目文件夾,並點擊「運行」,以確保它運行正確的文件。我已經添加了它所說的內容。 – Habit 2013-04-29 04:11:40