当我尝试从Release文件夹启动程序时,操作系统会打开一个错误窗口,显示以下消息:
在动态链接库libstc ++中找不到该过程的入口点_gxx_personality_v0。dll
这是源代码:
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <string>
#include "tinyxml.h"
using namespace std;
void write_app_settings_doc( )
{
TiXmlDocument doc;
TiXmlElement* msg;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
TiXmlElement * root = new TiXmlElement( "MyApp" );
doc.LinkEndChild( root );
TiXmlComment * comment = new TiXmlComment();
comment->SetValue(" Settings for MyApp " );
root->LinkEndChild( comment );
TiXmlElement * msgs = new TiXmlElement( "Messages" );
root->LinkEndChild( msgs );
TiXmlElement * deep = new TiXmlElement( "vector" );
msgs->LinkEndChild( deep );
string array[4] = { "Bayer Leverkusen", "Sporting Lisboa", "Villareal", "Montpellier" };
for(int i=0; i<4; i++) {
TiXmlElement * items = new TiXmlElement( "item" );
deep->LinkEndChild( items );
const char* text = array[i].c_str();
items->SetAttribute("id", i);
items->LinkEndChild( new TiXmlText( text ));
}
msg = new TiXmlElement( "Welcome" );
msg->LinkEndChild( new TiXmlText( "Welcome to MyApp" ));
msgs->LinkEndChild( msg );
msg = new TiXmlElement( "Farewell" );
msg->LinkEndChild( new TiXmlText( "Thank you for using MyApp" ));
msgs->LinkEndChild( msg );
TiXmlElement * windows = new TiXmlElement( "Windows" );
root->LinkEndChild( windows );
TiXmlElement * window;
window = new TiXmlElement( "Window" );
windows->LinkEndChild( window );
window->SetAttribute("name", "MainFrame");
window->SetAttribute("x", 5);
window->SetAttribute("y", 15);
window->SetAttribute("w", 400);
window->SetAttribute("h", 250);
TiXmlElement * cxn = new TiXmlElement( "Connection" );
root->LinkEndChild( cxn );
cxn->SetAttribute("ip", "192.168.0.1");
cxn->SetDoubleAttribute("timeout", 123.456); // floating point attrib
doc.SaveFile("appsettings.xml");
}
void Load() {
TiXmlDocument *doc = new TiXmlDocument("appsettings.xml");
doc->LoadFile();
TiXmlElement* root = doc->FirstChildElement("MyApp");
if (root) {
TiXmlElement* msgs = root->FirstChildElement("Messages");
TiXmlElement* input = msgs->FirstChildElement("vector");
TiXmlNode* child;
//for (child = input->FirstChild(); child; child = child->NextSibling()) {
while (child = input->IterateChildren(child)) {
TiXmlElement* item_element = child->ToElement();
cout << item_element->GetText() << "\n";
}
}
}
int main() {
write_app_settings_doc();
Load();
system("PAUSE");
return 0;
}
CodeLite 5.4 MinGW 4.8.1 Windows 7
答案 0 :(得分:0)
您可能有libstdc++6.dll
个文件不匹配
P.S。您可以使用#include <cstdio>
不要混合标题(有关差异的更多信息here)
答案 1 :(得分:0)
如果从codelite中运行它,请确保在路径中首先设置mingw 4.8.1 bin目录:
从codelite的主菜单: 设置 - &gt;环境变量
添加此行
PATH=/path/to/mingw481/bin;$PATH
在codelite外部运行时,只需复制可执行文件旁边的正确dll即可。
叶兰
答案 2 :(得分:0)
解决:问题发生在Windows环境变量中:在“系统属性” - >“环境变量”(在Windows 7中,在我的情况下)两个%PATH%变量(一个用于您的帐户和系统 - 宽变量%PATH%)没有MinGW路径(在我的情况下为C:\ MinGW \ bin)。 这不是一个小问题:要正常工作,只需将tinyxml .cpp文件添加到工作区,并在预处理器中包含tinyxml.h。