Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-01-2005, 01:15 PM   #1 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
How do you make include files?

I have noticed that it is increasingly difficult to continue further in my game I am making, unless I have a way to disperse the clutter I have in my one file. How exactly do you make an include file? Where should it be put at? Do I have to link it when I do g++ file.cpp -o file? (Like done with SDL) Do I name it a certain something? Thanx in advance!
slashdot is offline   Reply With Quote
Old 08-02-2005, 12:13 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
Include files are usualy named .h which is the header files that you use in order to tell other parts of your program what functions are available and how to use them.
I havn't got time right now to fully explain it, but later today I will describe it more specific and give some examples, for now the one thread that comes to mind, would be this one with my last post extending it to the fullest.
Basicaly you make a matching header (.h) file to predefine the functions available for everyone to use, then place the header aswell as the .c/.cpp file in the same folder as the project, include the header file by using " to surround it instead of <> precompile the provided .cpp file following the header into a .o file, then precompile your end program into a .o file, and link them all together into the executable.
It helps if you fully understand the preprocessor and what it does.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including Header Files and their cpp counterparts Rafkin Standard C, C++ 5 02-06-2005 09:48 PM
Linking between include files buchannon MS Technologies ( ASP, VB, C#, .NET ) 2 11-10-2004 11:35 AM
jsp include sde Java 6 08-19-2004 06:47 AM
Installing and using CMUgraphics library. Valmont Standard C, C++ 12 03-29-2003 08:39 AM


All times are GMT -8. The time now is 09:21 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting