Strange error Message on RUNning the EXE/Help

General questions regarding the usage of CodeLite
shiva
CodeLite Curious
Posts: 5
Joined: Sat Mar 26, 2011 3:09 pm
Genuine User: Yes
IDE Question: C++
Contact:

Strange error Message on RUNning the EXE/Help

Post by shiva »

ErrorPicCodelite3.png
I recently got started with CodeLite.
Slowly understanding.

As part of learning: I created a workspace. Then 2 projects. 1 project is a library archive, 2nd Project is a console executable.
I am running in on 64Bit, Win7 Professional , OS.

The library projects contains 1.h file and a .C file.
This creates a libswdlib.a file.

this is called/linked in 2nd project which creates the EXE file.

The snapshot shows the strange error.
Where am I doing the mistake ?

Here is the Code Snippets:

Code: Select all

 #include <stdio.h>
#include <SwissDomain.h>

int main(int argc, char **argv)
{
	SwissDomain xx("./Q8TCT8.txt");
	cout<<xx.getDomainSequence()<<endl;
	printf("hello world\n");
	return 0;
}
SwissDomain.h:

Code: Select all

#include<iostream>
#include<string>
#include <fstream>
#include <sstream>

using namespace std;

class SwissDomain
{
	int start_, end_;
	string description_;
	string sequence_;

	public:
	SwissDomain();
	SwissDomain(string filename);
	int getStartPosition();
	int getEndPosition();

	string getDomainSequence();
};
SwissDomain.C

Code: Select all

#include<SwissDomain.h>

SwissDomain::SwissDomain(){ };
SwissDomain::SwissDomain(string filename)
{
	ifstream fin(filename.c_str());
	string oneline;

	while ( getline(fin, oneline) )
	{
		if ( oneline.substr(0,2) == "FT" && oneline.substr(5,6) == "DOMAIN" )
		{
			string ig;
			stringstream k2(oneline);
			k2>>ig>>ig>>start_>>end_;
		}

		if ( oneline.substr(0,2) == "SQ"  )
		{
			while ( getline(fin,oneline) && oneline.substr(0,2) != "//")
			{
				string kk;
				stringstream k1(oneline);
				while(k1>>kk)
				sequence_ += kk;
			}
		}
	}
}
int SwissDomain::getStartPosition(){ return start_;}
int SwissDomain::getEndPosition(){ return end_;}

string SwissDomain::getDomainSequence(){
 	return sequence_.substr(start_-1, end_-start_+1);
}
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Strange error Message on RUNning the EXE/Help

Post by eranif »

Your error, is not related to codelite. Try a C++ forum or try to debug your program and see where it crashes

Eran
Make sure you have read the HOW TO POST thread
shiva
CodeLite Curious
Posts: 5
Joined: Sat Mar 26, 2011 3:09 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Strange error Message on RUNning the EXE/Help

Post by shiva »

Hi Eran,

I am able to compile and successfully execute this from the console.
simply typing:

g++ main.cpp -I./ -L./swdlib -lswdlib

When trying it via codelite, its giving the above error only on running. NOT during compilation.
I demonstrated this to my students. I want them to get started with CodeLite.
Personally, this has something to do with Codelite not with C++.

I will also look at the code which I pasted here.
Thanks for your inputs.
regards
Prasad.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Strange error Message on RUNning the EXE/Help

Post by eranif »

shiva wrote:Personally, this has something to do with Codelite not with C++.
I suggest 2 things:

1) Try to run codelite executable from the command line - see if it works
2) Try to debug it from within codelite. Can you confirm that you are passing the exact same command line arguments from within codelite as the one you are passing from command line? (if any are needed...)

Eran
Make sure you have read the HOW TO POST thread
shiva
CodeLite Curious
Posts: 5
Joined: Sat Mar 26, 2011 3:09 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Strange error Message on RUNning the EXE/Help

Post by shiva »

The update is:

I tried on Codelite on 32Bit XP system as well. Its not working.

Copied the Workspace from Win7 to Ubuntu 10.10 - still its not working.

Not able to locate the source of error .

I am also of the feeling now that it is problem with code not with codelite.
thanks.
Will post if it get resolved by some means.

regards,
Prasad.
josee
CodeLite Enthusiast
Posts: 37
Joined: Fri Feb 05, 2010 10:57 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Strange error Message on RUNning the EXE/Help

Post by josee »

Hi,

just check if you have set the correct working directory.

This is a most common error people make if they switch from cmdline to gui and vice versa.

Another is the correct setting of environment variables.

Hope this helps

Jörg Seebohn
Post Reply