Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: tomasbym on March 16, 2011, 12:36:13 pm
-
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
-
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.
-
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. 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.
-
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 .
-
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.
-
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 (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.
-
Thanks for explanation, but I am still struggling with the biggest issue - the debugging. Any suggestions?
Thank you,
T.
-
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.
-
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.
-
1. Have you tried the debugger's nightly?
-
No,
I don't know what does debugger's nightly mean. Can you please explain?
T.
-
No,
I don't know what does debugger's nightly mean. Can you please explain?
T.
http://forums.codeblocks.org/index.php/topic,14334.0.html
-
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.
-
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.
-
It might help to find the reason for your problem if you switch on the debuggers debug log ("Settings -> Compiler and debugger... -> Debugger settings -> Display debugger's debug log" and post the output here (with code-tags).
-
I see what may cause the problem. When I compile the project in CB I got few errors that filename_*.h cannot be found (I have the filename.h files in the project). Even though the project is compiled correctly. I don't get this type of errors when I run the same command from terminal. There is probably some mistake in the makefile but it is strange than it runs without problem from the terminal.
T.
-
I see what may cause the problem. When I compile the project in CB I got few errors that filename_*.h cannot be found (I have the filename.h files in the project). Even though the project is compiled correctly. I don't get this type of errors when I run the same command from terminal. There is probably some mistake in the makefile but it is strange than it runs without problem from the terminal.
T.
Make sure the project base (which is the base path for compilation) is the same for both cases: The command line compilation and the compilation inside C::B.
If you are using relative path's for includes (which is the common way of doing) the base path matters, obviously.