
-----------------------------------
Panphobia
Sun Dec 09, 2012 10:26 pm

Random compiling problem?
-----------------------------------
Well I have Ubuntu OS and I installed the gcc compiler but, whenever i try to compile and run my code in c++ that should work, it either does not output or gives a [code]Segmentation fault (core dumped) [/code] error, and it doesnt show anything, yes it runs for the odd program, but most of them dont work, even ones that work on other peoples computers, any ideas?

-----------------------------------
jbking
Mon Dec 10, 2012 11:16 am

Re: Random compiling problem?
-----------------------------------
Have you tried adding some logging to the program to see that parts of it are executing?  Have you examined if you have any dangling pointers being used that may cause the segmentation fault error?  Those would be my suggestions for where to look.

-----------------------------------
DemonWasp
Mon Dec 10, 2012 1:03 pm

RE:Random compiling problem?
-----------------------------------
Have you tried compiling a really simple program, like:

[code]
#include 
int main ( int argc, char ** argv ) {
    std::cout > n;
	  vector  cards(n);
	   int cardsLeft[n];
	for(int i = 0; i < n;++i)
	{
		cin >> cardsLeft[i];
		cards[i] = i + 1;
	}
	string phrase = "";
	for(int i = 0; i < n;++i)
	{
	    if(cards.size() - 1 - cardsLeft[i] < 0)
	    {
			cout 