CMD closes instantly after executing and creating Hello.exe

CodeLite installation/troubleshooting forum
RomanK
CodeLite Curious
Posts: 2
Joined: Tue Apr 22, 2014 6:56 pm
Genuine User: Yes
IDE Question: C++
Contact:

CMD closes instantly after executing and creating Hello.exe

Post by RomanK »

Hi everyone,
Just recently I've been teaching myself C Programming. When I create a source code (EX. Hello.c), compile the source code, and then execute the .exe file, I have an issue with the CMD. The CMD is able to execute the .exe, but it only executes the source code "Hello, World!" for about 1/10 of a second, then the CMD shuts down instantly.

Any ideas on how to fix this so that the CMD shuts down from an input of any button after the file is executed?

Thank you!!
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by eranif »

right click on the project -> settings -> common settings -> general
at the bottom of the page there is a check box: "pause when execution terminates" - tick it

Eran
Make sure you have read the HOW TO POST thread
RomanK
CodeLite Curious
Posts: 2
Joined: Tue Apr 22, 2014 6:56 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by RomanK »

eranif wrote:right click on the project -> settings -> common settings -> general
at the bottom of the page there is a check box: "pause when execution terminates" - tick it

Eran

I tried, still closes instantly. I tried using a a different IDE as well (Code::Blocks) and it does the same thing
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by eranif »

Please post some more information:

- The build log
- The content of the 'Trace' tab
- Can you run it from the command line?

Eran
Make sure you have read the HOW TO POST thread
User avatar
armin
CodeLite Curious
Posts: 6
Joined: Sat Apr 19, 2014 11:23 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by armin »

i hav this problem too, pause when execution terminates has tick,
http://s1.bild.me/bilder/260513/9467378problem.jpg

my build is:

Code: Select all

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 8 -e -f  Makefile"
"----------Building project:[ jet - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/A/Documents/CodeLite_job/work/jet'
mingw32-make.exe[1]: Leaving directory 'C:/Users/A/Documents/CodeLite_job/work/jet'
mingw32-make.exe[1]: Entering directory 'C:/Users/A/Documents/CodeLite_job/work/jet'
g++  -c  "C:/Users/A/Documents/CodeLite_job/work/jet/a1.cpp" -g -O0 -Wall -std=c++11  -o ./Debug/a1.o -I. -I.
g++ -o ./Debug/jet @"jet.txt" -L.
mingw32-make.exe[1]: Leaving directory 'C:/Users/A/Documents/CodeLite_job/work/jet'
0 errors, 0 warnings
my trace is:

Code: Select all

11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\config\accelerators.conf.default'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\abbreviation.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\cscope.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\external_tools.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\phplite.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\unittestpp.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite/config/accelerators.conf.default'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\abbreviation.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\cscope.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\external_tools.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\phplite.accelerators'
11:38:45: Loading accelerators from 'C:\Program Files (x86)\CodeLite\plugins\resources\unittestpp.accelerators'
11:38:45: Initializing refactoring database for workspace: work
11:38:45: Initializing refactoring database for workspace: work... done
11:38:45: Info: codelite is up-to-date (or newer), version used: 5.4, version on site: 5.4
11:38:45: Symbols file loaded into OS file system cache (0 seconds)
11:38:56: Error: Can't load bitmap 'question_and_answer' from resources! Check .rc file.
11:38:57: 0 needed to be parsed. Stored 0 new tags to the database
11:38:57: INFO: Retag workspace completed in 0 seconds (No files were retagged)
11:38:59: Error: Failed to kill process 7240 (error 0: the operation completed successfully.)
11:38:59: 0 needed to be parsed. Stored 0 new tags to the database
11:38:59: INFO: Retag workspace completed in 0 seconds (No files were retagged)
8-)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by eranif »

You are not executing it, you are 'debugging' it
The Green play button is for starting the debugger.
To execute it click on the cog icon with the orange arrow, or use Ctrl-F5

You can also place a breakpoint in your code, by simply left clicking on the left margin and when you hit the green play button (or F5) codelite will start the debugger and will stop there

Eran
Make sure you have read the HOW TO POST thread
User avatar
armin
CodeLite Curious
Posts: 6
Joined: Sat Apr 19, 2014 11:23 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: CMD closes instantly after executing and creating Hello.

Post by armin »

OH MY GOD :D !!! thank you ERANIF :o ctrl-f5
8-)
Post Reply