|
-
January 7th, 2011, 12:38 AM
#1
Can't compile; two source files
I'm learning c++ from a guidebook, and one of the exercises has me build and run a project with two source files. I'm using Code::Blocks on mac 10.6. When I try to build and run, it says there are no errors, but doesn't run.
The first (main.cpp) is:
Code:
#include <iostream>
using namespace std;
void ProgRun(int choice);
int main()
{
ProgRun(3);
return 0;
}
The second (othersource.cpp) is:
Code:
#include <iostream>
using namespace std;
void ProgRun(int choice)
{
cout << "You chose: " << choice << endl;
}
I click build and run (F9), and a dialog pops up, saying "This project has not yet been built," (what!?) "Do you want to build it?"
I click yes, and nothing happens. The build log says this:
-------------- Build: Debug in MultipleSource ---------------
Linking console executable: bin/Debug/MultipleSource
Undefined symbols:
"ProgRun(int)", referenced from:
_main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Not sure if this is a Code::Blocks issue or not (the mac build is apparently more buggy), but their message board specifically says not to ask questions about errors during build time, so I thought it best to ask here.
(Kind of reminds me of when I had problems running xp on my mac mini; Apple wouldn't help me because it was Microsoft software, and Microsoft wouldn't help me because it was Apple hardware.)
I googled the problem as any good person would and found many results, but I'm just fresh into the c++ world, and I couldn't understand anything I found. A little help in "beginner" language would be appreciated.
Thanks in advance.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|