Advertisement

Function Libraries

Started by May 16, 2002 07:44 PM
5 comments, last by bandman 22 years, 6 months ago
Dumb Question...How do I create a C++ function library of my own because I am lazy and I don''t like putting in the same function protoypes in all of the time. thanks guys
Just put all the prototypes into a header (.h or .hpp) file and then include it where you want all of the prototypes.
"I thought Genius lived in bottles..." - Patrick Star
Advertisement
But do I also include the function definitions?

Sort of. You don''t put the function definitions in a header, but rather in seperate .cpp file than your main source file.

-AJ

C:\DOS
C:\DOS\RUN
RUN\DOS\RUN

-Comic Book Store Guy''s t-shirt that I saw on the Simpsons, although it didn''t actually come from the Simpsons.

http://vdsoft.netfirms.com/home.html
C:DOSC:DOSRUNRUNDOSRUN-Comic Book Store Guy's t-shirt that I saw on the Simpsons, although it didn't actually come from the Simpsons.http://vdsoft.netfirms.com/home.html
function defenitions usually go in a corresponding c or cpp file.
ie)
// test.h#ifndef TEST_H_09875659876ADSF_#define TEST_H_09875659876ADSF_int add(int a, int b);#endif// test.cpp#include "test.h"int add(int a, int b);{   return a+b;}    


-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

-eldee;another space monkey;[ Forced Evolution Studios ]
Kylotan wrote an article on this over here: organising code files (nabbed from his sig).
Advertisement
Sorry I thought you just meant the Function declaration.
"I thought Genius lived in bottles..." - Patrick Star

This topic is closed to new replies.

Advertisement