我使用的是c ++ 11,还有一些没有为它配置的库,需要一些类型转换.特别是我需要一种方法转换std::__cxx11::string为常规std::string,但谷歌搜索我找不到一种方法来做到这一点,并放在(string)前面是行不通的.
如果我不转换,我会得到这样的链接器错误:
undefined reference to `H5::CompType::insertMember(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, H5::DataType const&) const'
编者注:类似于"程序错误点_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcRKS3_无法在动态链接库中找到libstdc++-6.dll"的错误消息具有相同的原因,并且适用相同的解决方案.
如果我想在Windows中运行我的Irrlicht C++控制台应用程序,我会不断收到此错误:
the procedure entry point __gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll
我正在使用CodeBlocks v12.11与MinGW和Irrlicht v1.8引擎.我正确设置了它.在我的电脑上还有一个安装了MinGW的Qt.是否可能存在冲突?
这是源代码:
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main() {
    IrrlichtDevice *device = createDevice( video::EDT_OPENGL);
    if (!device)
        return 1;
    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();
    guienv->addStaticText(L"Hello World", core::recti(10, 10, 100, 30));
    device->setWindowCaption(L"Hello World! - …我一直在XCode开发一个学校项目.最终产品必须在源代码中使用makefile提交,因此我编写了一个makefile并开始编译,以确保我有一个工作副本.这是我的makefile:
all: main.o StackList.o world.o Farm.o
        gcc main.o StackList.o world.o Farm.o -g -o Project1
main.o:
        gcc -g -c main.cpp
StackList.o:
        gcc -g -c Stacklist.cpp
world.cpp:
        gcc -g -c world.cpp
Farm.cpp:
        gcc -g -c Farm.cpp
clean:
        rm *.o Project1
编译每个目标文件工作正常,但当它到达"全部"链接步骤时,它似乎不知道标准库.我从"cin","basic_string"到"operator new"的每一个都得到"未定义的符号"错误.
我的印象是这些东西不需要直接表示,事实上过去并不需要这样做.
知道可能会发生什么吗?
编辑:
如果有帮助,这是(非常长的)错误消息的开头:
Undefined symbols for architecture x86_64:
  "std::cin", referenced from:
  _main in main.o
  "std::cout", referenced from:
      _main in main.o
      Farm::print(int)  in Farm.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced …