Author Topic: error/warning build messages don't locate source and header files  (Read 4380 times)

florent

  • Guest
Hi all,
I am compiling a project using a custom Makefile (generated by the GNU autotools). All source and header files are in a subdirectory named "src". When I compile the project, 'GNU make' does not indicate the path to erroneous files because it is internaly recorded by 'make'. As a result, C::B can't go to the erroneous lines in my code because it doesn't find source files in the project's top directory  :(. If I put the sources in the top directory (without using a subdirectory "src"), C::B is able to go to the erroneous lines. Is there a way either to force 'GNU make' showing complete file paths, or to indicate to C::B where the source and header files are located?
Thanks a lot in advance!

ps: I come from eclipse and it seems to me that C::B is far better for C++ than eclipse/CDT  :D ...unless I can't jump to erroneous lines in my "src" subdirectory  :lol:

florent

  • Guest
Re: error/warning build messages don't locate source and header files
« Reply #1 on: February 15, 2007, 02:47:44 pm »
Hum... No ideas? I'd just like to know if this feature is implemented or not.
I read the FAQ where it is indicated that one has to change "build method" to "work with makefiles" in order to compile with custom makefiles. Nevertheless, I can't change the build method because the associated list box is disabled and points to "invoke compiler directly". Is it a bug?
I compiled C::B revision 3595 from source with wx2.6.3 under linux Ubuntu edgy 6.10 (g++ 4.1.2).

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: error/warning build messages don't locate source and header files
« Reply #2 on: February 15, 2007, 03:28:14 pm »
Hum... No ideas? I'd just like to know if this feature is implemented or not.
I read the FAQ where it is indicated that one has to change "build method" to "work with makefiles" in order to compile with custom makefiles. Nevertheless, I can't change the build method because the associated list box is disabled and points to "invoke compiler directly". Is it a bug?
I compiled C::B revision 3595 from source with wx2.6.3 under linux Ubuntu edgy 6.10 (g++ 4.1.2).

This option is disabled because it will be removed. To use a custom makefile is enough to define it in the project properties dialog (as you probably already did).
About the error messages, it's a known limitation currently for makefile-based projects. The reason is what you said already: make enters each dir in succession to compile the files and so any error messages printed refer to local files (to that directory). We are looking for a workaround...
If you know of a "make" command line option that changes this behaviour, you can change the way C::B invokes "make" in the project build options dialog.
Be patient!
This bug will be fixed soon...

florent

  • Guest
Re: error/warning build messages don't locate source and header files
« Reply #3 on: February 20, 2007, 05:52:20 pm »
I found a nice solution. One has just to use a single custom Makefile in the project's root directory. GNU autotools are able to generate a single Makefile if there is a single Makefile.am in the root directory. Therefore, gcc's error messages are relative to the project's root directory so that C::B can find the erroneous files  :P
For more informations, see this excellent blog: http://www.mega-nerd.com/erikd/Blog/CodeHacking/nonrecursive_automake.html