Libraries

Reply

Join Date: Feb 2007
Posts: 5
Reputation: trunks1212 is an unknown quantity at this point 
Solved Threads: 0
trunks1212 trunks1212 is offline Offline
Newbie Poster

Libraries

 
0
  #1
Feb 26th, 2007
I'm trying to compile my program using library functions I created. I can't figure out how to get it to work. I'm going to attach my files so if someone could help me that would be great
Attached Files
File Type: cpp prog.cpp (2.5 KB, 2 views)
File Type: cpp proglib.cpp (2.2 KB, 2 views)
File Type: h proglib.h (305 Bytes, 2 views)
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 171
Reputation: Lazaro Claiborn is an unknown quantity at this point 
Solved Threads: 13
Lazaro Claiborn's Avatar
Lazaro Claiborn Lazaro Claiborn is offline Offline
Junior Poster

Re: Libraries

 
0
  #2
Feb 26th, 2007
Originally Posted by trunks1212 View Post
I'm trying to compile my program using library functions I created. I can't figure out how to get it to work. I'm going to attach my files so if someone could help me that would be great
First thing I'd suggest is to use condition prepressor directives to prevent header inclusion. In your header file "proglib.h" enclose your code like this:

#ifndef PROGLIB_H
#define PROGLIB_H
....function prototypes and/or constants and/or etc...
#endif

Next make sure your header file and its corresponding .cpp file are in the same directory, unless you've got your compiler configured to search certainly and not by default. Actually, what compiler you using? Is it command line or IDE GUI? Let me know.

Good luck, LamaBot
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 217
Reputation: Clinton Portis is an unknown quantity at this point 
Solved Threads: 22
Clinton Portis's Avatar
Clinton Portis Clinton Portis is online now Online
Posting Whiz in Training

Re: Libraries

 
0
  #3
Feb 26th, 2007
what compiler are ye' using?

for most IDE's like Dev CPP and MSVC++ 6.0, there is an option to, "add to project".. make sure the you are adding all 3 files to your project, then try to compile.

If you are using a command line compiler like borland, you will have to learn the codes for linking files together.. which I used to remember but I don't anymore.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 5
Reputation: trunks1212 is an unknown quantity at this point 
Solved Threads: 0
trunks1212 trunks1212 is offline Offline
Newbie Poster

Re: Libraries

 
0
  #4
Feb 26th, 2007
I'm using Dev CPP
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,050
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 331
Moderator
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Libraries

 
0
  #5
Feb 26th, 2007
>I can't figure out how to get it to work.
So then tell us what doesn't work, so we don't have to guess.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 5
Reputation: trunks1212 is an unknown quantity at this point 
Solved Threads: 0
trunks1212 trunks1212 is offline Offline
Newbie Poster

Re: Libraries

 
0
  #6
Feb 26th, 2007
Ok sorry I figured it out. I had to put #include <fstream> and using namespace std; in my header file and now it works fine. And I did what you said about putting all the files in a project. So sorry again and thank you for all your help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC