Skip to main content
gamedev.net
🔒 Locked

c++ file structure

Started by duckbob Jan 6, 2002 at 8:42 PM 5 replies 1.1k views
Original Post
duckbob
duckbob
ok, could someone point me to a good explination of c++ file sturcture...it doesn''t make sence to me. i''ve done quite a bit of programing and i understand the language in genreal buy i''ve taught myself everything i know and the whole header thing, and how additional files are added doesn''t make any sence to me. if someone could just point me at a good explination i would be very thankful duckbob
misterags
misterags
what compiler are u using?

Misterags™
duckbob
duckbob
Microsoft Visual C++...

xEricx
xEricx
I''d recommand you to get a book on VC++ and C++ in general, cause MSVC++ is pretty intuitive, so you must be lacking some knowledge in C++, or in the Win32 Environment (ClassView,FileView,Ressource View tabs...)

Anyway, sorry I can''t think of a way to explain how it works, it seems pretty understandable to me
duckbob
duckbob
heh, you see i taught myself it all, and i understand the program. what i''m asking is somthing that expains headers and such...basicly how multifile projects are linked together though them

hewhay
hewhay
I''m not quite sure about what you are asking but let me try an answer.
#include <filename> | #include "filename"
It means to find the file call filename on the include path wich in MSVC is someting like c:\Program Files\Microsodft Visual Studio\VC\include, and in the case of "filename" also on the current file. Now on the project setting on the (i guess) link tab it lists the libs use for the program. For examplw if you include iostream, it will find the definitions from iostream.h or iostream and the implemetation from a .lib who''s name i forgot.
humanity will always be slaved by its ignorance
capn_midnight
capn_midnight
okay, so you''re making your own header files in VC++.
I''m assuming you''re not using precompiled headers.
In your main source code file, include only the .h defenition files. In your .cpp implementation files, you also need to include the .h files. In both cases, it''s a little different from #include <stdio.h>. You have to use #include "myheader.h".
Now, in VC++, in your project workspace, click the file view tab, click the ''+'' next to "(yourProject) files" and right click source files. click add files and put in ALL of your .cpp files. once that is done, right click header files and add all your .h files to that.

THat should do it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.