Code::Blocks
April 21, 2014, 04:01:02 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Don't forget to check the Nightly builds in the appropriate forum.
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: PCH in object output dir (possible bug?)  (Read 1893 times)
starkos
Newcomer
*
Offline Offline

Posts: 8


« on: August 30, 2006, 02:40:57 pm »

New to C::B, and I'm not sure if this is a bug of if I am just using it wrong.

I set up my first CB project and it is building fine. I wanted to get the precompiled headers out of the source code directory, so I changed the project settings to "Generate PCH in the object output dir". When I rebuild, CB can no longer find my header files ("No such file or directory"). I was able to work around it by adding each directory that contains header files to the Compiler Directories on the build options dialog. Should this really be necessary?

FYI, I am trying to add support for C::B to Premake, a build script generation tool (http://premake.sourceforge.net/). The idea is to write a script that describes your project, and then use Premake to generate the actual project files for your toolset. I already have support for Visual Studio 6-2005 and GNU makefiles -- CB support would be a nice addition. I need to put the PCH files in the obj dir to keep the behavior consistent across all of the different tools I support.

Thanks for the help,
Jason
Logged
mandrav
Project Leader
Administrator
Lives here!
*****
Offline Offline

Posts: 4269



WWW
« Reply #1 on: August 30, 2006, 03:01:31 pm »

Can you post a minimal sample project demonstrating what you 're describing?
Logged

Be patient!
This bug will be fixed soon...
starkos
Newcomer
*
Offline Offline

Posts: 8


« Reply #2 on: August 30, 2006, 04:05:56 pm »

Sure, here are the Premake sources with a C::B workspace. I've configured the project to show the error (PCH are set to obj dir, source code directories are not listed in Compiler Directories).

FWIW, I'm trying to build it with the 8/29 nightly snapshot.

Thanks for the help,
Jason


[attachment deleted by admin]
Logged
tiwag
Developer
Lives here!
*****
Offline Offline

Posts: 1196


sailing away ...


WWW
« Reply #3 on: August 30, 2006, 06:16:06 pm »

why don't you want to add simply "Lua" to the compiler directories ?

i can't find any bug related to PCH  :?

[attachment deleted by admin]
Logged
mandrav
Project Leader
Administrator
Lives here!
*****
Offline Offline

Posts: 4269



WWW
« Reply #4 on: August 30, 2006, 06:25:02 pm »

Either you have some misunderstanding of what is a precompiled header (PCH), or you failed to communicate your real problem to me.

The project you attached does *not* use precompiled headers.
Yes, it fails to build but because you haven't setup the compiler's include directories. This has nothing to do with PCH.

Please read this wiki article. If we are still talking about the same thing, please describe your problem with more details so I can understand what it is.
Logged

Be patient!
This bug will be fixed soon...
starkos
Newcomer
*
Offline Offline

Posts: 8


« Reply #5 on: August 30, 2006, 06:41:27 pm »

Try switching the PCH option from "obj dir" to "alongside original header"; the project will now build just fine. If the project can build under one setting, shouldn't it be able to build with the other?

You are correct, I am not using precompiled headers on this particular project. Should that prevent the project from building?

This isn't a showstopper for me, I can just configure Premake to output the "alongside original header" option always. I was just hoping to keep the behavior consistent across all of the toolsets.

Thanks,
Jason
Logged
starkos
Newcomer
*
Offline Offline

Posts: 8


« Reply #6 on: August 30, 2006, 06:48:58 pm »

Just to clarify - this is not a PCH problem. If C::B had an option "don't create PCH" I would check it and leave it at that. My question is: why does this project build fine when set to "alongside original header" but not build at all when set to "object output dir"?

To clarify further - I realize I can work around this issue by adding "Lua" to the include directories. But why do I need to set up include directories for "object output dir" and not for "alongside original header"?

Thanks for the continued assistance,
Jason
Logged
tiwag
Developer
Lives here!
*****
Offline Offline

Posts: 1196


sailing away ...


WWW
« Reply #7 on: August 30, 2006, 07:03:59 pm »

the problem is not related to pch generation,
it's just by coincidence that the additional compiler options which were added by CB,
if you select pch in object output dir, prevent compiling or the other way round,
it coincidentally compiles if you switch to pch alongside header file.

the real necessity is ALWAYS to specify the necessary directories,
where the compiler shall look for the headers.

therefore adding Lua to the list of compiler include-directories is not a workaround, it's the correct project setup.
« Last Edit: August 30, 2006, 08:12:23 pm by tiwag » Logged
mandrav
Project Leader
Administrator
Lives here!
*****
Offline Offline

Posts: 4269



WWW
« Reply #8 on: August 30, 2006, 07:24:05 pm »

therefore adding Lua to the list of compiler include-directories is not a workaround, it's the correct project setup.

Exactly.
True, when you select PCH in "object output dir", it does alter your include paths to accomodate this. But this is a side-effect (which I fail to see as a bug).
But the correct thing to do, regardless of using PCH or not (and what PCH option), is to setup the project's include dirs as needed. This will ensure correct project setup, which is then unlikely to fail.
Logged

Be patient!
This bug will be fixed soon...
starkos
Newcomer
*
Offline Offline

Posts: 8


« Reply #9 on: August 30, 2006, 07:40:37 pm »

Thanks for your replies and your patience.

The project I attached above should not require any include directories to be set. All includes are of the form `#include "somefile.h"`. The compiler is supposed to look in the same directory as the including file; this is per the language spec.

However, I gather from your responses that this is something that GCC is doing under the hood, and is out of the control of C::B. That's fine. I just needed to understand the cause of the problem so I could choose an appropriate workaround. I'll just always set the option to "alongside original header" and leave it at that. If in the future you find time for a "No precompiled headers" option, that would be great.

Thanks again for your help. I will drop a note when the next version of Premake -- with C::B support! -- is released.

Jason
Logged
mandrav
Project Leader
Administrator
Lives here!
*****
Offline Offline

Posts: 4269



WWW
« Reply #10 on: August 30, 2006, 08:04:54 pm »

Quote
The project I attached above should not require any include directories to be set. All includes are of the form `#include "somefile.h"`. The compiler is supposed to look in the same directory as the including file; this is per the language spec.

That's true. But C::B's current build system, builds each file using the project file's dir as cwd. This is easily configured by going to global compiler settings, "Other" page, checkbox "Explicitely add currently compiling file's dir to compiler's search dirs". But this is a global option, not a per-project one. So, if you want the projects premake generates to be built flawlessly everywhere, you should setup the compiler's dirs correctly.

Quote
I will drop a note when the next version of Premake -- with C::B support! -- is released.

You do that Wink.
Logged

Be patient!
This bug will be fixed soon...
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!