Author Topic: program compiles, builds but does not run  (Read 5643 times)

Offline Glassborow

  • Single posting newcomer
  • *
  • Posts: 3
program compiles, builds but does not run
« on: November 27, 2012, 11:57:28 pm »
Whilst I am not new to Codeblocks (using it on Windows based machines) I am now trying to use it on a raspberry pi using the Denbian distro of Linux which is new territory for me.

I have (AFAICS) installed codeblocks and GCC 4.6 . I am now trying to develop a console app.

I am running codeblocks in an LXTerm 'window'. I have successfully created a console program (a simple hello world) and compiled and built it. Howver when I come to try to run it from within codeblocks I get an error@

Process terminated with status of 255.

The debug compile and built program runs correctly when invoked from outside codeblocks.

If it matters I am using SVN 8621.

Looking at the environment settings the following may be relevant:

Shell to run commands in  /bin/sh -c
Terminal to launch console programs:  xterm -T $TITLE -e

Can anyone help me over this hurdle

Thanks
Francis Glassborow

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: program compiles, builds but does not run
« Reply #1 on: November 28, 2012, 11:19:45 am »
I suspect your program doesn't have a return statement or return -1.

Quote
Process terminated with status of 255.
show the return code of your application.

I suggest to check the 'pause when execution ends' in project properties.

In console:
Code
 ./yourApp
 echo $?
The second line will show the last return code.
(and it should be the same as reported by the IDE).


Offline Glassborow

  • Single posting newcomer
  • *
  • Posts: 3
Re: program compiles, builds but does not run
« Reply #2 on: November 28, 2012, 12:53:46 pm »
Thanks for your attempt find my problem. Unfortunately none of your suggestions move me forward  :(

I suspect your program doesn't have a return statement or return -1.

No, it has a perfectly adequate return 0

Quote
Process terminated with status of 255.
show the return code of your application.

I am pretty sure that that return code is bot from my program but from the process invoked to run my program.

I suggest to check the 'pause when execution ends' in project properties.

I had already checked, and it is. All my years of experience suggest that the problem occurs before my program starts. I get three messages in the build log window

Checking for existence: /home/pi/myprogs/test2/bin/Debug/test2
Executing: xterm -T test2 -e /usr/bin/cb_console_runner_LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/pi/myprogs/test2/bin/Debug/test2 (in /home/pi/myprogs/test2/.)
Process terminated with status 255 (0 minutes 1 seconds)



In console:
Code
 ./yourApp
 echo $?
The second line will show the last return code.
(and it should be the same as reported by the IDE).

first line executes program, second line outputs nothing or was that supposed to be a batch file?

Thanks for trying
Francis



Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: program compiles, builds but does not run
« Reply #3 on: November 28, 2012, 01:29:53 pm »
Try preview before posting, your quoting is wrong.

What is the result of following command in console ?
Code
xterm -T test2 -e /home/pi/myprogs/test2/bin/Debug/test2

Do you have xterm installed ?

If not, Search in the forum how to change 'terminal' that CB uses or install xterm.

Offline Glassborow

  • Single posting newcomer
  • *
  • Posts: 3
Re: program compiles, builds but does not run
« Reply #4 on: November 28, 2012, 04:01:59 pm »
OK it was the lack of xterm. I now have it sorted but still having problems with quoting  :)
I will get it sorted eventually

Thanks
Francis