Author Topic: Building single compilation unit doesn't work  (Read 4212 times)

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Building single compilation unit doesn't work
« on: September 11, 2010, 09:32:12 am »
When I right click on a .cpp file in my workspace and pick 'Build File', it gives me in the build log:

Execution of 'cl.exe /nologo  /Od /Zi    /I"C:\Program Files\Microsoft SDKs\Windows\v6.0A\include" /I"G:\Microsoft Visual Studio 9.0\VC\include"  /c main.cpp /Foobj\Debug\main.obj' in 'G:\footest' failed.

But when I do a project build/rebuild it works just fine. Any ideas what's wrong? This happens with VC toolchain and GCC toolchain. Oddly enough, Borland toolchain does not exhibit this problem.

Did anyone run into this issue before?

stefanos_

  • Guest
Re: Building single compilation unit doesn't work
« Reply #1 on: September 11, 2010, 10:45:36 am »
Are you talking about Visual Studio or Code::Blocks? Because I'm confused from your description...

In case you are talking about VS, please read the rules of this forum and expect a moderator to lock / disable this topic.
« Last Edit: September 11, 2010, 10:47:21 am by stefanos_ »

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Building single compilation unit doesn't work
« Reply #2 on: September 11, 2010, 08:20:06 pm »
This is C::B using the VS toolchain obviously

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Building single compilation unit doesn't work
« Reply #3 on: September 12, 2010, 03:34:51 am »
Just to add to this info, I found that if I duplicate the build target and set it the compiler toolchain to be different from the project root toolchain, requesting a single file build will actually generate an uncaught exception crashing C::B.

The nightly build I am using is svn 6271 May 22 btw.

Thanks

Offline driftcode

  • Single posting newcomer
  • *
  • Posts: 4
Re: Building single compilation unit doesn't work
« Reply #4 on: September 13, 2010, 02:01:28 pm »
How serendipitous!!  I was just coming here to report this same issue.  I've done a bit of tinkering and discovered the issue.

If the current target uses a different compiler than that which was chosen when the project was created, then using the Build menu option "Compile current file" or its shortcut (ctrl-shift-F9) or right-click + "Build file" in the Management pane results in an "Execution of 'compiler' in 'project' failed." message.  The likely cause is that that specific routine does not use the proper executable paths (e.g. searches for bcc32.exe in the gcc path.)  The full "Build" (ctrl-F9 or right-click project) command works as expected.  I tested with 3 projects using different initial compilers with additional build targets using diverse compilers.  Each time, the only "Compile current file" that was correct was for the initial compiler.  I also tested simply changing the compiler for the "default" targets and the same issue arises; "Compile current file" fails while "Build" succeeds.