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

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

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.

I'm using Dev CPP

>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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.