Page 1 of 1

C++ Primer code from book [Solved]

Posted: Sun Sep 29, 2013 5:07 am
by 5k3105
I'm trying to setup the IDE to where I can test each program individually in debug mode. The code (http://www.informit.com/content/images/ ... _4_7_0.zip) has a makefile in the main folder that calls each makefile per folder/chapter.

I have created a workspace using Custom Make and used 'Import Files from Directory' to get all the files to show up in the workspace file tree.

At this point I'm not sure what CodeLite is trying to do when I hit F5 - it says:
Debugger exited with the following error string: "No executable specified, use 'target exec'."
What I was trying to do was open the file I wished to test and hit F5 to run it in debug mode. I know it's probably not that easy.

Re: C++ Primer code from book

Posted: Sun Sep 29, 2013 1:05 pm
by eranif
You will need to tell codelite which executable to debug.

This is done from:
Project Settings -> General -> Program to Debug / Run
Set there the executable to debug

Eran

Re: C++ Primer code from book

Posted: Sun Sep 29, 2013 11:35 pm
by 5k3105
It will debug the executable, but I don't know how to make it debug the code - like setting breakpoints in the code etc.

Re: C++ Primer code from book

Posted: Sun Sep 29, 2013 11:39 pm
by eranif
Read this:

http://codelite.org/LiteEditor/Debugging
http://codelite.org/LiteEditor/UsingBreakpoints
The screenshots are a bit old, but the concept remains (including the keyboard shortcuts)

Eran

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 12:19 am
by 5k3105
The problem is that, since I 'Import Files from Directory' for one chapter, I have multiple individually executable programs in one project. So I can't seem to select a single program as the active project for the workspace because all the programs are in the same project.

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 12:56 am
by eranif
Just select the executable you want to debug in the project setting.
codelite does not really care which exe it starts to debug...

Eran

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 1:35 am
by 5k3105
But that doesn't allow me to set breakpoints in code or singlestep through code lines, right?

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 7:56 am
by eranif
5k3105 wrote:But that doesn't allow me to set breakpoints in code or singlestep through code lines, right?
ofc it does, if it does not allow you to do that - then make sure you have compiled your code with debugging symbols enabled (-g)

Eran

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 6:18 pm
by Jarod42
I have created a premake script to generate Codelite projects up to chapter 6 here:
premake.7z.

Re: C++ Primer code from book

Posted: Mon Sep 30, 2013 11:53 pm
by 5k3105
Jarod42 wrote:I have created a premake script to generate Codelite projects up to chapter 6 here:
premake.7z.
Thank you Jarod! That worked great. Now each program has it's own project and I can set that project to active in order to debug. Merci beaucoup!