User forums > Using Code::Blocks

program compiles, builds but does not run

(1/1)

Glassborow:
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

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


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

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

In console:

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

Glassborow:
Thanks for your attempt find my problem. Unfortunately none of your suggestions move me forward  :(


--- Quote from: jarod42 on November 28, 2012, 11:19:45 am ---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.
--- End quote ---
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 $?
--- End code ---
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



--- End quote ---

jarod42:
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
--- End code ---

Do you have xterm installed ?

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

Glassborow:
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

Navigation

[0] Message Index

Go to full version