Error at program launch

General questions regarding the usage of CodeLite
User avatar
Mograine
CodeLite Curious
Posts: 6
Joined: Mon Dec 16, 2013 7:52 am
Genuine User: Yes
IDE Question: C++

Error at program launch

Post by Mograine »

When I try to launch a program from the Release folder, the OS opens a error window with this message:

Can not find the entry point _gxx_personality_v0 of the procedure in the dynamic link library libstc++.dll

This is the source code:

Code: Select all

#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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Error at program launch

Post by eranif »

Did you compile all the libraries yourself? ( e.g. Is tiny XML library you are using was self compiled?)
Usually this means that you are mixing compilers versions - e.g. If might be that the tinyxml was compiled with a different version of bcc from you main program

Eran
Make sure you have read the HOW TO POST thread
User avatar
Mograine
CodeLite Curious
Posts: 6
Joined: Mon Dec 16, 2013 7:52 am
Genuine User: Yes
IDE Question: C++

SOLVED

Post by Mograine »

Solved: the problem was in the Windows environment variables: in the "System Properties"->"Environment Variables" (in Windows 7, in my case) both %PATH% variables (the one for your account AND system-wide variable %PATH%) there wasn't the MinGW path (C:\MinGW\bin in my case).
It wasn't a tinyxml problem: to work properly, just add the tinyxml .cpp files to the workspace and include tinyxml.h in the preprocessor.
CodeLite 5.4
MinGW 4.8.1
Windows 7
Post Reply