User forums > Embedded development

Problems building sdcc c file with codeblocks

<< < (2/2)

yipinx:
@scarphin: Yes I thought it was something like that, but I do not know any way to see how a file is compiled; what directives it is given. Anyway I found it. Its in the project's build options. The root node on the left pane shows you the project and its build targets. It is possible to set each build target individually but at the project level as well. And that is where it goes wrong.

Let me try to explain what I mean by taking the codeblock project file once again:

<CodeBlocks_project_file>
   <Project>
      <Option compiler="gcc" />    <!---- OUT OF THE BUILD AND TARGET SCOPE --!>
      <Build>
         <Target title="Debug">
            <Option compiler="gcc" />
            <Compiler />
         </Target>
         <Target title="MSX2 - Debug">
            <Option compiler="sdcc" />
            <Compiler />
         </Target>
      </Build>
      <Compiler> <!-- OUT OF THE BUILD AND TARGET SCOPE --!>
         <Add option="-Wall" />
      </Compiler>
   </Project>
</CodeBlocks_project_file>

The last compiler element in the project file is defined outside the build targets scope and even though the second target doesn't use gcc but sdcc, the projects compiler option -Wall will be executed, because it is defined at project wide scope and codeblocks doesn't check that the compiler for the build target is not the same as the project wide compiler. I think the problem can be easily solved when the project file is changed to something like this:

<CodeBlocks_project_file>
   <Project>
      <Option  />
      <Build>
         <Target title="Debug">
            <Option  />
            <Compiler select="gcc" />
         </Target>
         <Target title="MSX2 - Debug">
            <Option  />
            <Compiler select="sdcc" />
         </Target>
      </Build>
      <Compiler select="gcc">
         <Add option="-Wall" />
      </Compiler>
   </Project>
</CodeBlocks_project_file>

This way, at project level, one can set different compiler directives for each compiler and override them per build target.

Secondly, since I believe this IS a bug, one can first check the Option compiler attribute at project level to be the same as the current build target and include or not include the extra compiler options when the target compilers(!!) are the same. (This is not happening right now)

cheers,
Johan


Jenna:
You can either remove the project-wide -Wall or change the "Policy:" dropdown of the target(s) to "Use target options only".

yipinx:
@jens: :) thanks, will change it right away!

Navigation

[0] Message Index

[*] Previous page

Go to full version