This is the first time I'm trying to compile code that I've written using a main program file, a .h file and a .cpp implementation file. I'm using Dev C++ 22.214.171.124 and when I try to compile my main.cpp file, I get several errors of this sort.
1 F:\COP1335C\LAB#3\Time.cpp In file included from F:\COP1335C\LAB#3\Time.cpp
24 F:\COP1335C\LAB#3\Time.h expected unqualified-id before "int"
24 F:\COP1335C\LAB#3\Time.h expected `)' before "int"
9 F:\COP1335C\LAB#3\Time.cpp expected type-name
9 F:\COP1335C\LAB#3\Time.cpp expected unqualified-id before "int"
9 F:\COP1335C\LAB#3\Time.cpp expected `)' before "int"
9 F:\COP1335C\LAB#3\Time.cpp expected `,' or `;' before "int"
I did a google search on some of these errors and it was suggested to place include #<iostream> and using namespace std; into my .h file, but it didn't make a difference.
Also, there were example files from class that I used dev c++ to compile and it worked fine without namespace or iostream in the .h file, so there has to be an error either in my code or I'm missing something trying to get these files to work together to make an executable. All of the files for the program are in the same directory.
Time.cpp is the implementation file and I have #include "Time.h", #include<iostream> and
using namespace std in it at the top. In my .h file, I have #ifndef TIME_H
#define TIME_H, my class definitions and then #endif at the very end.