| | |
Help please, getting this to compile (using Dev C++)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Trying to get this to compile is driving me nuts! Any help is greatly appreciated. I think it's having trouble linking the header to the .cpp files. It's my first program in Dev C++ - I'm used to using Visual Studio.
Here's the source for the header header:
and here's the header:
Thanks in advance for any help,
Nate
Here's the source for the header header:
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <stdlib.h> #include "SmpMth.h" using namespace std; int SmpMth::Add(int a, int b) //Postcondition: // The sum of two ints is returned { return a+b; } int SmpMth::Max(int a, int b) //Postcondition: // The maximum of two ints is returned { if(a>b) { return a; } else return b; } int SmpMth::Min(int a, int b) //Postcondition: // The minimum of two ints is returned { if(a<b) return a; else return b; }
and here's the header:
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <stdlib.h> using namespace std; class SmpMth { public: int Add(int, int); int Max(int, int); int Min(int, int); SmpMth(); SmpMth(int, int); private: };
Thanks in advance for any help,
Nate
Behind every great gymnast - is a mentally unstable coach.
Thanks, but I didn't even make it an application of either type to begin with. I just opened up new source files each time, and saved them as a .h and .cpp files. I also had another .cpp file that I was using in conjunction... here's the code for that one:
Hope this helps a little more, sorry I didn't think to include it to begin with.
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <stdio.h> #include "SmpMth.h" using namespace std; //This is only a test driver for the SmpMth class int main() { int a,b; char var; cout<<"******Min, Max & Add********\n" <<"\n\n"; cout<<"Add two numbers together: "; cin>>a,b; cout<<"\n" <<Add(a,b) <<"\n"; system("PAUSE"); return 0; }
Hope this helps a little more, sorry I didn't think to include it to begin with.
Behind every great gymnast - is a mentally unstable coach.
•
•
•
•
Originally Posted by Coach_Nate
Thanks, but I didn't even make it an application of either type to begin with. I just opened up new source files each time, and saved them as a .h and .cpp files.
![]() |
Similar Threads
- Why won't this compile (C++)
- small program request (C++)
- Grrr C++ Help Me! (C++)
- Visual Studio 6: Initializing static class member (C++)
- Sockets Help (C++)
- Best free C/C++ compiler for a newbie? (C++)
- Graphics in Pixel,Mode13h:Part 1 (C++)
- I need a project ;P (C++)
Other Threads in the C++ Forum
- Previous Thread: Need some advice on a fairly big project
- Next Thread: Simple Class Question
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete desktop developer directshow dll download dynamic encryption error file forms fstream function functions game generator getline givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






