I am relatively new to c++, i have been working on an application to have me import names into an array. its a console app, but i keep getting a linker error that says:fatal error LNK1120: 1 unresolved externals. I do not know what this means here is the code:
#include <iostream> //cin and cout are defined in here
#include <fstream> //never used
#include <string> //never used
usingnamespace std;
//global variables are 99.9% of the time bad. they should be inside of main
int index; //this is only used as an iterator for ur 'for' loop so should be declared in there
int count = 1;
int names []; //incomplete type. this is where ur linker error probably is. u need to give it a size...
//also, 'names' suggests that u want to write chars into here, not ints
int main()
{
//why count so high to 3000? make sure this doesn't count more than the size of the names[]
// or u'll get some more undefined behavior
for( index = 1; index < 3001; index ++)
{
cout << "Client Name"<<count<<": "; //'count' never increments
cin >> names[index]; //this will fail if u put in anything but an integer
}
return 0;
}