News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Custom makefile problems

Started by tomasbym, March 16, 2011, 12:36:13 PM

Previous topic - Next topic

tomasbym

Hello everybody,
I am having troubles with compiling my project in CB. I have a directory SRC with all the source files and makefile. There is a subdirectory MAKE with makefiles (makefile.type) with different setting. When I compile the project from terminal in SRC I just type make type where type refers to one of the file in the MAKE directory.
In CB I put the project to the SRC directory, in compiling options checked the use custom make file. I am sure that for compiling I need to add the custom variables, but don't know how exactly. In the build/target project variables I have $make -f $makefile $target. I ve tried many ways how nad where to write type but without any success.
Any help would be really appreciated,
Thanks Tomas

Jenna

It should work if you use "type" as target-name.
You can copy or rename the standard targets in "Project -> Properties -> Build targets".
And thee chose the correct target from the dropdown-list in the compiler toolbar.

tomasbym

Thank you for you reply,
I changed the target to type and now the project compiles even though I got errors during compiling but the program is running. But unfortunately I am still having some problems
1) I can no run the program but cannot debug it - i.e. it doesn't stop on my breakpoints
2) I execute the program from command line like program <inputfile , where program is the generated program and inputfile is the file with the input for the program. Is there any way how to run it from CB so that is reads the specific inputfile? I can change the source code, but it is not very convenient as I still would like to have option to run it the normal way from terminal.
3) I am not able to run the clean command from CB. It is not a big problem as I can still do it from terminal with make clean-all or make clean-type but I am sure there is an option to do it from CB.
Thanks you once again for your help. Question number 1 is the most important the other two are not that crucial.
Tomas

oBFusCATed

1. Have you tried the debugger's nightly?
3. You can modify all make commands that are executed. It is in project -> build options or project -> properties, it is one of the last tabs and in most cases it is not visible.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Jenna

Quote from: tomasbym on March 18, 2011, 01:30:20 PM
Thank you for you reply,
I changed the target to type and now the project compiles even though I got errors during compiling but the program is running. But unfortunately I am still having some problems
1) I can no run the program but cannot debug it - i.e. it doesn't stop on my breakpoints
2) I execute the program from command line like program <inputfile , where program is the generated program and inputfile is the file with the input for the program. Is there any way how to run it from CB so that is reads the specific inputfile? I can change the source code, but it is not very convenient as I still would like to have option to run it the normal way from terminal.
3) I am not able to run the clean command from CB. It is not a big problem as I can still do it from terminal with make clean-all or make clean-type but I am sure there is an option to do it from CB.
Thanks you once again for your help. Question number 1 is the most important the other two are not that crucial.
Tomas
1. Do the makefiles set the -g option to create debugging-symbols ?
2. "Project -> Set programs's arguments.."
3. You have to fix the appropriate make-command in the projects/targets "Build options -> 'Make' arguments" for the cleaning process (in your case most likely a "-" between clean and $target .

tomasbym

Hello,
1)No I don't use the -g argument in makefile. I thought I just need to have it checked in Compiler and Debugger settings.
2) Solved, thanks
3) That was a first thing I've tried but without success. I don't understand quite well how this works, but unfortunately I haven't found any documentation - I assume that the variable $makefile if the name of my makefile and $target is the target name - what is the $make variable? The command I need to execute is make clean-all
Thank you again for all your replies,
T.

Jenna

You should turn on full commandline logging to see which commands are executed: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

$make is the name of the make-executable as it is set in the "Toolchain executables" tab of the compiler you use,

$makefile is the name of the makefile as it is set in your project properties. It's needed, if the makefile is not named like the default makefile of your make-executable.

$target is the name of the target you currently compile.

tomasbym

Thanks for explanation, but I am still struggling with the biggest issue - the debugging. Any suggestions?
Thank you,
T.

Jenna

Quote from: tomasbym on March 18, 2011, 05:46:52 PM
Thanks for explanation, but I am still struggling with the biggest issue - the debugging. Any suggestions?
Thank you,
T.
Without -g (if it's gcc) you have no chance.
If you use custom makefiles, you have to set it in the makefile, because you bypass C::B's build-system.
Some makefiles also have debug-targets, but you have to search for it in your makefile or in the documentation yourself.

tomasbym

Hello,
I am able to debug the program with gdb from terminal. It should means that I had compiled it correctly with the debug marks. But I am not able to debug using CB.
Thanks,
T.

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

tomasbym

No,
I don't know what does debugger's nightly mean. Can you please explain?
T.

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

tomasbym

Thanks,
I will have a look at it. So do you think that the new version of debugger should solve my problem? Are there some major differences between the new nightly versions and the official relase?
T.

tomasbym

Hello,
I downloaded the latest version 7040, but still without success. I am able to debug the program from terminal using GDB but not from CB. Do you know what may be a problem??
Thanks T.