Advertisement

XCode include path problem

Started by February 09, 2006 09:37 AM
4 comments, last by basement 18 years, 8 months ago
I am porting a codebase from MS VisualStudio to XCode. The libraries header files are seperated like this:
-include
	-foo
		-foo.h
		-bar.h
	-baz
		-baz.h
	...
[Edit: Leading whitespace is removed by the forum unless you place it within a [code] block - Oluseyi] Throughout the source, header files are included like "#include <foo/foo.h>", "#include <baz/baz.h>" I created a "include" group in XCode that added my headers recursively but I can't get it to compile unless I remove the subfolders from the #include directives (i.e. #include <foo.h> instead of <foo/foo.h>) This should be easy but I can't seem to figure out how to make it work in the XCode's funny ui. I added a header searchpath in XCode for the top-level "include" directory but that didn't change anything. I can't just change all #include directives either because that would break the build on Windows for other people. Anyone know how to fix this simple problem? [Edited by - Oluseyi on February 9, 2006 9:59:48 AM]
In your diagram, it looks like all the files are at the same level in the folder hierarchy.

You need to clarify how they are laid out.
Advertisement
Quote: Original post by RichardS
In your diagram, it looks like all the files are at the same level in the folder hierarchy.

You need to clarify how they are laid out.

You've been a member since 2004. You should know that leading whitespace disappears unless escaped by [code]. Further, based on the paths specified in his include statement, you should have immediately seen what he was trying to describe.

[Sorry, I can't respond to the actual question. I've never used Xcode.]
Yeah sorry that came out wrong. Thanks for indenting :) Don't have access to the mac now so haven't found a solution yet.
From your description, It sounds like you're trying to do this by adding the headers themselves to the file listing on the left-hand side of the window, which doesn't actually change the include paths used by the compiler.

Select 'Edit active target 'x'' from the Project menu.
Choose the Build tab.
Choose "All Configurations" from the Configuration popup button.
Choose "Search Paths" from the Collection popup button.
Double click on the entry marked 'Header Search Paths'
Add the path to the top level include folder. You should not select 'recursive'.

These instructions assume you are using Xcode 2.2 or 2.2.1. It is different for older versions.
Yep, thanks, it worked. I am using XCode 2.1. For some reason it didn't work when I added the search path globally in the compiler settings.

This topic is closed to new replies.

Advertisement