Page 1 of 1
Strange error Message on RUNning the EXE/Help
Posted: Wed Apr 06, 2011 11:37 am
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);
}
Re: Strange error Message on RUNning the EXE/Help
Posted: Wed Apr 06, 2011 8:33 pm
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
Re: Strange error Message on RUNning the EXE/Help
Posted: Thu Apr 07, 2011 7:59 am
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.
Re: Strange error Message on RUNning the EXE/Help
Posted: Thu Apr 07, 2011 9:57 am
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
Re: Strange error Message on RUNning the EXE/Help
Posted: Thu Apr 07, 2011 12:46 pm
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.
Re: Strange error Message on RUNning the EXE/Help
Posted: Fri Apr 08, 2011 11:52 am
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