-
C++
Hey, I compiled the code, the one that I just asked about before (after i fixed it), and this window popped up called "Compiler and Linker Output" and it says... " C:\DEV-C_~1\Lib\\libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16' ". That was after i pushed the "Compile and Run" option on the top of Dev-C++. the window said there were 0 errors, it had me press "continue" and that window was there...can someone explain to me what i am doing wrong?:(
-
Show us some code!! We can 't help otherwise.
Mr. C.
-
C++
Sorry about that...here, i will post the question again and the code this time...
Hey, I compiled the code, the one that I just asked about before (after i fixed it), and this window popped up called "Compiler and Linker Output" and it says... " C:\DEV-C_~1\Lib\\libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16' ". That was after i pushed the "Compile and Run" option on the top of Dev-C++. the window said there were 0 errors, it had me press "continue" and that window was there...can someone explain to me what i am doing wrong? Here is the code...
Code:
#include <iostream.h>
#include <stdlib.h>
bool accept3()
{
int tries = 1;
while (tries < 4) {
cout<<"Do you want to proceed (y or n)?\n";
char answer = 0;
cin >> answer;
switch (answer) {
case 'y':
return true;
case 'n':
return false;
default:
cout<<"Sorry, I don't understand that.\n";
tries = tries + 1;
}
}
cout<<"I'll take that for a no.\n";
return false;
}
Code tags added by Kermi3
-
In the future please use code tags when posting code. I added them for you this time. People are MUCH more likely to help you if you use them.
Info on code tags may be found here:
http://www.cprogramming.com/cboard/s...threadid=13473
-
cant see anything wrong with code you posted. Ill assume its just a snippet and you have a main() somewhere.
The error you are getting is usually associated with trying to compile a console program as a windows program.
Check your settings and be sure you are compiling for the right subsystem.
-
When you complile your project in dev c++ you need to create a
win32 console project. You also need to define main.
Code:
#include <iostream.h>
#include <stdlib.h>
bool accept3();
bool accept3()
{
int tries = 1;
while (tries < 4) {
cout<<"Do you want to proceed (y or n)?\n";
char answer = 0;
cin >> answer;
switch (answer) {
case 'y':
return true;
case 'n':
return false;
default:
cout<<"Sorry, I don't understand that.\n";
tries = tries + 1;
}
}
cout<<"I'll take that for a no.\n";
return false;
}
int main()
{
accept3();
return 0;
}