Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > .C .H #include path madness

.C .H #include path madness
Thread Tools
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
Dec 21, 2003, 11:50 PM
 
Hi,
I'm writing a C++ program, with .H and .C files. In the .C file (called BezierEdge.C) I have:
Code:
#include<BezierEdge.H>
and then, BezierEdge.H is in the same folder. No matter what I do, it will not find the header file unless I do:
Code:
#include</Users/gtaubman/Desktop/VSim/BezierEdge.H>
I feel like that's ridiculous, and I've never had to do that on other platforms, and I remember not having to do that in other programs I've written in OS X. Help! What am I doing that's so stupid!

Incase it matters, I'm using Makefile builds, and the output of a successful compile looks like this:
Code:
g++ -g -DCG_ENABLED -Wimplicit -Wreturn-type -Wformat -Wparentheses -Wpointer-arith -Woverloaded-virtual -c BezierEdge.C g++ -g -DCG_ENABLED -Wimplicit -Wreturn-type -Wformat -Wparentheses -Wpointer-arith -Woverloaded-virtual -c ViolaSimMain.C g++ -o ViolaSim -g -DCG_ENABLED -Wimplicit -Wreturn-type -Wformat -Wparentheses -Wpointer-arith -Woverloaded-virtual BezierEdge.o ViolaSimMain.o -framework OpenGL -framework GLUT -lobjc
gabe
     
Junior Member
Join Date: Dec 2003
Location: New Jersey
Status: Offline
Reply With Quote
Dec 22, 2003, 01:26 AM
 
Originally posted by Zimwy:
Hi,
I'm writing a C++ program, with .H and .C files. In the .C file (called BezierEdge.C) I have:
Gabe,

I just started on C++ myself, but one of the first mistakes I made was naming my files .c and .h. For some reason I had thought that you could keep those extensions, but I guess the compiler often gets confused interpreting C++ code unless you're using .hpp and .cpp (or .cc).

Ben
MacBook 2.4 GHz
Mac OS X 10.5.8
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Dec 22, 2003, 01:39 AM
 
Use quotes instead of angle brackets.
Code:
#include "BezierEdge.H"
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Senior User
Join Date: Feb 2001
Location: Deer Crossing, CT
Status: Offline
Reply With Quote
Dec 23, 2003, 01:32 PM
 
Originally posted by smeger:
Use quotes instead of angle brackets.
Code:
#include "BezierEdge.H"
To expand on this, only use the <> symbols for standard libraries. You can find these libraries in /usr/include

For example, #include <sys/time.h> would be found in the /usr/include/sys/ directory.

Use the "" symbols for non-standard libraries (which are usually in the same dir as the source you are compiling.
20" iMac G5! :D AND MacBook 1.83GHz!
Canon Digital Rebel Kit + 75 - 300mm lens. Yum Yum! :D
Check out my OS X Musical Scales program
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 02:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2