I've recently started programming in C++, so I don't know much about errors. I've just created a new program, but when I'm trying to execute the code, Dev-C++ (the compiler I'm using) shows 2 errors.
1 2
[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status
It doesn't show a location, so I don't know where the error is.
Does anybody know what this means?
It means your project settings are bad. ou need to pick whatever passes for just plain C++ code. No Win16 (Win16? Yikes - I presume you're not using a pre Windows 95 OS?) or other such settings.
Which version of Dev-C+pp are you using? If it's from here:
The mistake is that your project settings have told the linker that your code contains a WinMain16. It's not a line of your code causing the problem - it's that your code (and all the libraries it is looking in) doesn't contain what it's looking for.
#include <iostream>
#include <string>
usingnamespace std;
string aName[9] = "";
string aPassword[9] = "";
int lNumber, lPassword, aCurrent, aNumber, aStatus[9];
int Setup(){
for (int i = 0; i < 9; i++)
{
aStatus[i] = 0;
}
aName[0] = "admin";
aPassword[0] = "password";
aStatus[0] = 3;
aNumber = 1;
return 0;
}
int dLogin();
int dVersiondata();
int dLogin()
{
dVersiondata();
cout << "Accounts\n";
for (int i=0;i<9;i+=1)
{
if (aStatus[i] > 0)
{
cout << i+1 << ". " << aName[i] << endl;
}
}
cout << "11. Shut down\n";
system("PAUSE");
return 0;
};
int dVersiondata()
{
system("CLS");
cout << "AmijOS C++\n\tAlpha 0.0.1 - Copyright 2012 by OjimaProductions\n";
return 0;
};
It should create a simple screen, it's not much yet. It's a program I first programmed in BASIC, but when I saw the limited possibilities in BASIC, I thought I might wanted to reprogram it in C++.
hmm, tried it, I renamed Setup to main (btw, thanks, didn't know that :))
Now I'm getting no more warnings or errors. Thanks!
(and now I see what a complete n00b I am...)