New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Adding Header File for C++ Program in Xcode

Post Reply New Thread Subscribe

Thread Tools

Member Since: Nov 13, 2008
Posts: 2
bcarpenter is on a distinguished road

bcarpenter is offline
Hi all,

I've been using Microsoft Visual Studio for my basic C++ class at Ucla. I know how to create a project and everything, but am confused about which folder to add a header file.

In visual studio, there is a "Header Files" folder right above the "Source Files" folder in which you can add your header files.

In Xcode, there is no such folder. Where do I add my header file?

Under the "Documentation" or "Products" folder perhaps?

Thanks for your help,

QUOTE Thanks

Member Since: Nov 13, 2008
Posts: 2
bcarpenter is on a distinguished road

bcarpenter is offline
i think i got it, is this the correct location? the header file i was tying to add is cards.h .

Free File Hosting Made Simple - MediaFire

it doesnt look like the picture wants to show up, but its Picture 1.jpeg once you click on the link.
QUOTE Thanks

Member Since: Mar 15, 2007
Posts: 161
mystic_fm will become famous soon enough
Mac Specs: 17" MacBook Pro, 2.33GHz C2D, 2GB RAM

mystic_fm is offline
Sorry, I won't visit the link you provided (particularly since MediaFire shows many reports of popups and browser exploits on SiteAdvisor).

In all of the smaller Xcode projects I've encountered, header files are usually dumped into both the same physical folder and the same "project group" as their corresponding implementation files (i.e., either "Classes" or "Other Sources", whichever is appropriate). However, there's nothing constraining you from categorizing things in the project differently if you wish. At a minimum, you could easily add a "Header Files" project group to "virtually" separate the header files if that would make things feel more familiar to you.

(Ignore the next two paragraphs if they are too confusing.)

You could go a step further and also create a separate physical location for those files. In this case, just remember that the compiler for each source file needs to be able to find the referenced header files, so if you have them physically separated, you must either specify a relative path to those header files in your #include (or #import) directives, or else add each of the header file folders to the "user header search path" in the project's build settings.

By the way, you could also organize your header files differently in Visual Studio if you wanted to ... the default project organization that VS gives you is not cast in stone either.
QUOTE Thanks

Post Reply New Thread Subscribe

« EggDrop and GCC | Translation of Iris script into Darwin »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Adding subtitles into .avi file drorbn2000 Movies and Video 5 12-27-2010 11:42 AM
xcode stream problem mitchell OS X - Development and Darwin 0 07-09-2008 05:02 AM
File name problems NeilBarber Images, Graphic Design, and Digital Photography 5 04-25-2007 07:15 AM
Windows 2003 File Server & Quark kegwell OS X - Operating System 0 01-15-2007 02:35 PM
XCode Include path problem Jove OS X - Development and Darwin 0 03-18-2005 09:41 AM

All times are GMT -4. The time now is 06:06 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?