C++ Primer code from book [Solved]

General questions regarding the usage of CodeLite
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

C++ Primer code from book [Solved]

Post 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.
Last edited by 5k3105 on Tue Oct 01, 2013 9:10 am, edited 1 time in total.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post by 5k3105 »

But that doesn't allow me to set breakpoints in code or singlestep through code lines, right?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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
Make sure you have read the HOW TO POST thread
User avatar
Jarod42
CodeLite Expert
Posts: 239
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: C++ Primer code from book

Post by Jarod42 »

I have created a premake script to generate Codelite projects up to chapter 6 here:
premake.7z.
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: C++ Primer code from book

Post 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!
Post Reply