Author Topic: Compiler Error not hilighted when target setting is different than project  (Read 584 times)

Offline ikk_

  • Single posting newcomer
  • *
  • Posts: 6
    • github
Hello.

What I'm trying to report is that it appears to be a bug that prevents compilation errors from being reported correctly in the editor in the CodeBlocks IDE, in the following specific case.

It happens only when using Menu - Build - "Compile current file" and not when using Build or Rebuild - the other compiling methods. Additionally, the project compiler must be set to different than the Target compiler, in the Project Build Options window.

To summarize, following is needed:
1. Using Menu - Build - "Compile current file"
2. Project compiler set to different than Target compiler.

In my case specifically, what I have set is the "*Np Compiler*" compiler as Project compiler and the "GNU GCC Compiler" compiler as the Target compiler. I have tested this on my customized CodeBlocks IDE v17.12 for Windows and on the 20 April 2019 build  - it appears it persists there too. Please check attached screenshot animation below (about 46s long).


https://drive.google.com/file/d/1GDRz9m48bIihCaUU7zkJnQbVok34Jj38/view?usp=sharing

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Hello,
thank you for the report. Generally bugs are better in the sourceforge bug tracker then here, because here they will get lost...

Now to your finding... Codeblocks does not really support compiling without project, or compiling only a single file...
i can reproduce this bug...

This is pure speculation from my side, i have not looked into the code:
A file can be part of multiple targets so if you compile one file codeblocks in general does not know for what target it should compile (the first, all the files belong to ecc...)
So i think the default compiler and settings of the project are used.
In your case it seems that there is some "residual" compiler setting from the project that triggers the compilation, but the errror parser does not kick in...
The question, before i dig into this is:
1) How should codeblocks behave for compiling a single file? If it is part of multiple targets ask the user for what target to compile?

I clearly think there is some bug down there, because the file should not compile at all if there is no project setting...

Offline ikk_

  • Single posting newcomer
  • *
  • Posts: 6
    • github
@BlueHazzard
After further investigating it myself, it seems that IDE is parsing compiler output using wrong settings. It seems it pulls regex, that parse the output, from what is set in the current Project compiler, while instead it should use Target comnpiler settings. Compiler settings for error parsing I'm talking about are here, in C::B IDE: Menu - Settings - Compiler... - then the "Other  settings" tab - then "Advanced options..." button.

So, if it happens that the project has the same compiler set in both those places it works as expected, because it ends up using correct regex anyway. If it indeed functions how I see it so far.

I did used global compiler settings in the IDE, added or removed my own compilers there, so I may have made some mistakes that cause additional errors. As you mentioned, these are important. However I've tested on different C::B versions and problem seems to persist.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2455
Can you please make a ticket where you describe your findings?
I will then try to look into it....

Offline ikk_

  • Single posting newcomer
  • *
  • Posts: 6
    • github
Bug reported by me here: https://sourceforge.net/p/codeblocks/tickets/830/
Thanks for your assistance BTW.
« Last Edit: May 19, 2019, 12:11:19 am by ikk_ »