Author Topic: Custom Makefile: double click on compiler errors doesn't open the source file  (Read 3326 times)

Offline pozzugno

  • Multiple posting newcomer
  • *
  • Posts: 39
I have a project with the following structure:

prj
  prj.cbp
  src
    main.c
    ...
  build
    mingw
      Makefile


In the Project->Properties I set build\mingw as the Execution directory. In the Build options I set $make -f $makefile as command for Build project/target.
The compilation works well.

If there's a compilation error, the compiler outputs something similar (in Build log):

../../src/main.c: In function 'app_init':
../../src/main.c:459:31: error: expected ';' before numeric constant
    app_trigger_signal_on_GPIO 7);
                               ^
mingw32-make.exe: *** [Makefile:1120: output/objs/qcli/pal.o] Error 1


In the Build messages window I see the row:

build\mingw\src\main.c|459|error: expected ';' before numeric constant|

Of course, when I double click on this row, C::B doesn't open the relevant file, because it is src/main.c (relative to project file) and not build\mingw\src\main.c.

What is the solution of this problem?

I tried to set Execution directory to . (the same folder of project file), but at the moment make works only if launched in the same directory of Makefile (build/mingw).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
I'm not sure these is a solution to this problem. Does it work if you use "make -f build/mingw/Makefile" as the build command?
(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!]

Offline pozzugno

  • Multiple posting newcomer
  • *
  • Posts: 39
I'm not sure these is a solution to this problem. Does it work if you use "make -f build/mingw/Makefile" as the build command?

Do you mean changin execution directory too in Project -> Properties? Yes, it works, but I have to fix something in the Makefile.

Anyway, why C::B transform the file ../../src/main.c in the compiler error message into build\mingw\src\main.c? It doesn't make sense to me.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Because someone has to implement a translation and every target can have a different execution path, so it becomes complicated, probably.
(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!]