User forums > Using Code::Blocks

Noob question about inlcuding .h files

(1/2) > >>

iio:
I have a Bullet demo that I know works that won't compile in C::B. I have included the .h files' directory in the Porject's Build options and it has worked for other header files but doesn't for some. Error is:

No such file or directory


I have even tried including the files in the project hierarchy but to no avail. I ma new to C::B so am I missing something?



Thanks,
iio

DrewBoo:
Can you tell us more, iio?  Which includes work?  Which don't? Can we see the code?  What directories work?  Which directories don't work?

gomer:
Hi,

I'm new to Code::Blocks, but not to C++.  Code::Blocks seems to be a good ide, but I'm having some trouble with headers in projects similar to that noted by iio.  That is : the gnu C++ compiler reports the message "No such file or directory" even thought the header exists in the project in the headers folder.  The problem can be solved including the folder that contains the header in the "Search directories" under build options.  Obviously, the header file could have been located using the entry under the project->headers folder, but it wasn't.  This raises the question : what is the headers folder used for if not to locate headers?  Could anyone provide any insight here?

thanx - in advance

Jenna:
The "Source", "Headers" ... folders are virtual folders, that make it easier to handle a great amout of source-files.

You can switch them on and off. Just right-click your project, chose "Project tree" and check or uncheck "Categorize by file types".

They have nothing to do wit the search-directories for the compiler and/or the linker.

EDIT:
Here is how gcc searches for includes:

Quote from cpp-manual:

--- Quote ---#include <file>
    This variant is used for system header files. It searches for a file named file in a standard list of system directories. You can prepend directories to this list with the -I option (see Invocation).
#include "file"
    This variant is used for header files of your own program. It searches for a file named file first in the directory containing the current file, then in the quote directories and then the same directories used for <file>. You can prepend directories to the list of quote directories with the -iquote option.
--- End quote ---

gomer:
First of all - thanx for the incredibly quick reply!

Ok - I think I've got it.  The Sources / Headers virtual folders only separate the various project inputs by file type.  C/C++ sources get translated into object files via a compiler when building, but .H files don't.  I.E. header files and all non source code file types are ignored as project inputs even though they appear  as such in the project hierarchy.

thanx again.

Navigation

[0] Message Index

[#] Next page

Go to full version