Hi, I'm writing a program for class that requires the use of two .cpps and two .h files. I can get the main file (main.cpp) to read the function declaration header (funhead.h), but not the function definition file (fundef.cpp).
I've been trying to work out the structure of this code before filling in the details, so some things are very simple. All files are in the same directory.
Here are the relevant sections:
1 2 3 4 5 6 7 8 9 10 11 12
//funhead.h
#include <iostream> // all libraries needed for main and fundef
#include <stdio.h>
#include <stdlib.h>
#include <string>
#ifdef funhead
#define funhead
void fun_newcourse(); //adds a new course
#endif
When I attempt to compile (using MinGW), it says "error: 'fun_newcourse' was not declared in this scope"
If I move the declaration into main.cpp, the program compiles and the fun_newcourse executes just fine, but I have to put the declaration in a separate .cpp file for this assignment.