Here is my code. Im getting a error C2447: '{' : missing function header (old-style formal list?) error and i have no idea what this is. any help would be appreciated.....,. Thanks
I think, giving it a quick scan, that you have missed out int main... you have a 'pointless' declaration of main at line 7 but no definition, I would assume that it should be around line 27. The error is refering to the openiing brace on line 27.
also the closing brace at line 100 should be above JobsWithTimeLeft(),
Try changing your code arounld line 20 to:
1 2 3 4 5 6 7 8 9 10 11 12
int main(void)
{
//Declarations
double TimeQ, CSOH;
double AvgWaitTime = 0;
double AvgTATime = 0;
double CurrTime = 0;
int i;
//Input
cout << "Please enter the TIme Quantum between 1 and 5 (ms): ";
...
It is trying to make main() a template function. My compiler (g++) complains with the following errors:
test.cpp:7: error: cannot declare `::main' to be a template
test.cpp:27: error: expected unqualified-id before '{' token
The first is just as I described. The second is due to the fact that you have a block of code that doesn't belong to a function, a class, etc.
All your code has matches for opening/closing delimiters, it seems. However, once you fix those issues, you'll need to adjust your braces, just as Grey Wolf suggested. After all, you can't have the JobsWithTimeLeft() function inside the main() function.
I completed all of those updates and im still getting these errors. Heres the errors and the code again thanks
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(15) : error C2955: 'Job' : use of class template requires template argument list
1> c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(14) : see declaration of 'Job'
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(15) : error C2148: total size of array must not exceed 0x7fffffff bytes
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(15) : error C2512: 'Job' : no appropriate default constructor available
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(20) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(102) : fatal error C1004: unexpected end-of-file found
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(18) : error C2144: syntax error : 'void' should be preceded by ';'
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(18) : warning C4091: '' : ignored on left of 'void' when no variable is declared
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(19) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\matt\documents\visual studio 2005\projects\project 1\project 1\1.cpp(100) : fatal error C1004: unexpected end-of-file found
bool JobsWithTimeLeft();
int main(void)
{
//Declarations
1 2 3 4
system("PAUSE");
}
bool JobsWithTimeLeft() {
I believe that should do it. It compiles for me in both Visual C++ 2008 Express Edition and g++ (MinGW) 3.4.5 if I substitute your code for those changes.
error C2144: syntax error : 'void' should be preceded by ';'
warning C4091: '' : ignored on left of 'void' when no variable is declared
error C2447: '{' : missing function header (old-style formal list?)