So I've got a project file in CodeBlocks for Project Euler, but I'm a bit confused about what I've done wrong in setting my code up. I have a main.cpp file for running my programs, and I prototype each problem's function before I use it in the main block. However, I have this error when trying to build it:
||=== Build: Debug in Project Euler (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function main':|
C:\Users\under\cpp-workspace\Project Euler\main.cpp|9|undefined reference to
p4()'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
This is what I have, so I'm not sure what's wrong?
main.cpp:
#include <iostream>
using namespace std;
void p4();
int main()
{
p4();
return 0;
}
p4.cpp:
#include <iostream>
using namespace std;
void p4()
{
cout << "hello there" << endl;
}
I'm not sure what's wrong?
My question is not a duplicate, at least not that I can tell. The question this is supposedly a duplicate of never mentions the issue I'm having.