Code::Blocks Forums

User forums => Help => Topic started by: fei123 on June 07, 2010, 05:48:28 pm

Title: (pictures) how codeblock find executabl file maked by custom Makefile to debug
Post by: fei123 on June 07, 2010, 05:48:28 pm
i use codeblocks in linux.

i have a program with source code.i  make it's own "Makefile"  in the program folder .then it will
get 5 executable files ,include "disksim" executable file.
i can debug the source code in the gdb ,use the command in the terminal of linux
"gdb --args ./disksim synthraid5.parv synthraid5.out ascii 0 1 " ,so the file "synthraid5.parv " can be add into the
the executable file "disksim" as a parameter.and raid5.out is the output filename.

now i want to use codeblocks to debug the program..
but i donot success.
here is my steps:
1.I make a project in codeblocks in /home/codeblocksproject1,the codeblocks project file  
codeblocksproject1cbp is in the folder .
(http://lh6.ggpht.com/_1KyCMnXSC8o/TA0NXqy6BPI/AAAAAAAAAA0/LTU7mHi9ioo/%E5%BB%BA%E7%AB%8B%E5%

B7%A5%E7%A8%8B1.jpg)


2. then i copy the all the files of program include it's own Makefile into the folder of
codeblocksproject1 project. so the codeblocks can find the custom Makefile
(http://lh6.ggpht.com/_1KyCMnXSC8o/TA0NXsOOyII/AAAAAAAAAA4/CL5cXi1BT7s/copy%20source%20code.jpg)


3.then i add the files recursively into the project.
(http://lh4.ggpht.com/_1KyCMnXSC8o/TA0NXzCj2eI/AAAAAAAAAA8/MR_Tx2YKV88/3add%20files%

20recursively.jpg)


4.the i   Check "This is a custom makefile", change the build target   .and finally build sucess.
(http://lh6.ggpht.com/_1KyCMnXSC8o/TA0NX5vRYJI/AAAAAAAAABA/fHKgGAJqIK0/4%20change%20build%
20target.jpg)
(http://lh3.ggpht.com/_1KyCMnXSC8o/TA0NXx_mNTI/AAAAAAAAABE/LXGL-Mkvb60/5%20build%20sucess.jpg)


4. get 5 executable files ,include "disksim"
(http://lh6.ggpht.com/_1KyCMnXSC8o/TA0XbYnftnI/AAAAAAAAABg/ga7lMymlz3A/6.get%205%20executive%20file.jpg)

5.  after i input the parameter " synthraid5.parv synthraid5.out ascii 0 1 " in the "Project->Set programs' arguments" ,and choose
"disksim"executable file as "host application"
but i cannot run sucessly.
(http://lh5.ggpht.com/_1KyCMnXSC8o/TA0QZhExIDI/AAAAAAAAABY/x5Kj12ADOjU/7.programe%
20paramater.jpg)


what is the problem?
i think maybe the codeblock can not find the executable file.
what can i do.
 please   as specific as possible and step by step..
thank you for your help .
 I'd appreciate it if you could help.





Title: Re: (pictures) how to debug program with custom Makefile
Post by: Jenna on June 07, 2010, 05:57:43 pm
Go to "Project -> Properties -> Build targets -> all" (in your case) and change the defaoult output filename to the one that is created by the build.
C::B does not parse the makefile and does not know what it does, so it can not find the exe itself.
Title: Re: (pictures) how to debug program with custom Makefile
Post by: fei123 on June 07, 2010, 06:13:54 pm
Go to "Project -> Properties -> Build targets -> all" (in your case) and change the defaoult output filename to the one that is created by the build.
C::B does not parse the makefile and does not know what it does, so it can not find the exe itself.

thank u for your help ..
I change the defaoult output filename to the one that is created by the build(disksim executable file in the directory of  codeblockproject1/src/  )
there are another questions.

(http://lh3.ggpht.com/_1KyCMnXSC8o/TA0bx_tOLSI/AAAAAAAAABw/PX40OT5p1oY/wrong1.jpg)

(http://lh3.ggpht.com/_1KyCMnXSC8o/TA0aLZW0VxI/AAAAAAAAABo/cXBWGMjv01s/wrong.jpg)

the path is wrong..disksim_main.c is in codeblockproject1/src/disksim_main.c
Title: Re: (pictures) how to debug program with custom Makefile
Post by: fei123 on June 07, 2010, 06:59:33 pm
(http://lh6.ggpht.com/_1KyCMnXSC8o/TA0j8jqaZpI/AAAAAAAAAB4/Bu3_jaP1yps/%E6%AD%A3%E7%A1%AE%E8%A7%A3%E6%B3%95.jpg)
i find the method .
it need to change the execution working dir as the same directory of the executable file that is created by the the Makefile.

Go to "Project -> Properties -> Build targets -> all" (in your case) and change the defaoult output filename to the one that is created by the build.
C::B does not parse the makefile and does not know what it does, so it can not find the exe itself.

thank u for your help ..
I change the defaoult output filename to the one that is created by the build(disksim executable file in the directory of  codeblockproject1/src/  )
there are another questions.

(http://lh3.ggpht.com/_1KyCMnXSC8o/TA0bx_tOLSI/AAAAAAAAABw/PX40OT5p1oY/wrong1.jpg)

(http://lh3.ggpht.com/_1KyCMnXSC8o/TA0aLZW0VxI/AAAAAAAAABo/cXBWGMjv01s/wrong.jpg)

the path is wrong..disksim_main.c is in codeblockproject1/src/disksim_main.c