如何让我的IDE提供C++库
How do I get my IDE to provide the C++ libraries?
我了解了如何在编译时获得正确的当前版本的GNU。
现在,每当我试图编译。。我得到了大量的错误,我认为这些错误与C++库有关。我目前在我的MacBook上使用NetBeans最新版本,并安装了Mountain Lion。
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,std::___1::分配器>::compare(char const*(const",引用自:弹药.o中的弹药::setElementDataArmor.o中的Armor::setElementData(std::__1::basic_string,std::_1::allocater>,std:Consumerable.o中的可消费::setElementDataCreature.o中的Creature::setElementData(std::__1::basic_string,std::_1::allocater>,std:实体.o中的实体::setElementData(std::__1::basic_string,std::_1::allocater>,std:Item.o中的项::setElementDataparser.o中的parseElement(std::__1::basic_stream>&,std::_1::vector>&XMLSerializable*(。。。"std::_1::_vector_base_common::__throw_length_error((const",引用自:_ZNSt3_16vectorIP4ItemNS_9allocaterIS2_EEE6assignIPS2_EENS_9enable_ifIXsr21_is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in Creature.oCreature.o中的std::_1::vector>::allocate(unsigned long(void std::_1::vector,std::__1::allocater>,std:::__1::分配器,std:(std::__1::basic_string,std::___1::allocater>const&(在Entity.o中在解析器.o中无效std::_1::vector>::_push_back_slow_path(XMLSerializable*const&(在CreatureFactory中无效std::_1::vector>::_push_back_slow_path(Creature*const&(。oCreatureFactory中的std::_1::vector,std::__1::allocater>,std:;__1::分配器,std::__1::分配程序>>::分配(无符号长(。ostd::_1::vector>:__append(unsigned long,Tile const&(在DungeonLevel.o中…
你知道为什么会发生这种事吗?它甚至与图书馆有关吗?
您的问题是函数调用错误。
-
您当前正在调用一个使用
FILE
指针的getline
版本,这不是您想要的。这是编译器根据包含的头找到的唯一一个。 -
您可能正在尝试从输入流中提取一行,对吗?试试这个吧。确保
#include <string>
。 -
此外,您可能不希望在输出流上调用
getline
。。。
---编辑---
您添加的错误看起来像是您的库路径设置不正确。。。很抱歉,如果没有访问系统的权限,很难解决这个问题,希望其他人能帮助你。祝你好运
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 架构决策:返回std::future还是提供回调
- 何时提供默认参数作为模板参数
- 无法在windows控制台中为C++程序提供必要的输入
- 我可以做些什么来消除或最小化这种将提供相同功能和行为的代码重复
- 提供与TMP和SFINAE的通用接口
- 是否值得降低我的代码的可读性,以便在出现内存不足错误时提供异常安全性?
- 为 std::variant 提供一个运算符 ==
- WinSock2:connect() 提供"连接被拒绝"
- COUT 无法提供输出可能是由于内联组装
- 我的 If Else 语句无法在向量 (C++) 中提供最大值
- 与其他编译器相比,相同的代码在工作室Microsoft提供不同的输出
- Linux承诺的内存比它所能提供的要多
- std::p romise::set_value() 和 std::future::wait() 是否提供内存围栏?
- C++ 确保子类为常量提供自定义值
- C++有什么方法可以在既不调用函数模板也不提供其模板参数的情况下引用函数模板?
- 将共享库的搜索路径更改为生成文件中提供的 rpath
- 可以从std::string继承以提供类型一致性吗
- 错误:从"int"到"int*"的转换无效[-允许].我在下面提供了我的代码,我
- 为什么许多项目不提供预编译的二进制文件?