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 > using a c++ class

using a c++ class
Thread Tools
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Nov 4, 2001, 07:16 PM
 
I'm working on an openGL game (using GLUT), and have a quick question...

what do I have to do to use a c++ class, for example, i want to define a box class - so i create a new c++ file, type all the necessary code - but when i try to instantiate a new box object from my main code, it says that the type is not defined.
do i have to include the class file in some way?
(its my first time with c++, but I know that the code is all correct)

thanks
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Areas 51 thru 55 :P
Status: Offline
Reply With Quote
Nov 5, 2001, 12:58 AM
 
I am assuming that you created both a Box.h and a Box.cc file (declaration and definition files). If not, well, you're gonna have to.

In main.cc, do a #include "Box.h" and you should be good to go.
Well, let's just say, 'if your VCR is still blinking 12:00,you don't want Linux'
     
Senior User
Join Date: Feb 2001
Location: Rochester, uk
Status: Offline
Reply With Quote
Nov 5, 2001, 06:35 AM
 
More generally, any good would tell you that, so if you haven't got a good book, get one.

I'm currently reading "Practical C++" (from, i think, Que) and it seems pretty good.
All words are lies. Including these ones.
     
Mac Enthusiast
Join Date: Jan 2001
Status: Offline
Reply With Quote
Nov 5, 2001, 08:52 AM
 
thanks, ill pick up that book...
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Areas 51 thru 55 :P
Status: Offline
Reply With Quote
Nov 5, 2001, 09:11 AM
 
Originally posted by sadie:
<STRONG>More generally, any good would tell you that, so if you haven't got a good book, get one.

I'm currently reading "Practical C++" (from, i think, Que) and it seems pretty good.</STRONG>
My personal fav is "Thinking in C++".

If you plan on doing a lot of C++ development you may want to think about *eventually* getting a copy of John Lakos' book "Large Scale C++ Software Design" or something like that.
Well, let's just say, 'if your VCR is still blinking 12:00,you don't want Linux'
     
   
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 09:58 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