Reputation: 11
EDIT: Thanks to some help, I see that I was just missing parentheses. Problem solved.
Recently Visual Studio has been giving me errors on the simplest things that are not actually wrong, and because of this I cannot run any program, and it is very frustrating. I have Visual Studio Professional 2013 with Update 5, running on Windows 10. Let me give an example.
When I write the program:
#include <iostream>
using namespace std;
int main
{
cout << "Hello World!" << endl;
return 0;
}
I get the errors:
main.cpp(6): error C2143: syntax error : missing '}' before ';'
main.cpp(8): error C2059: syntax error : 'return'
main.cpp(9): error C2059: syntax error : '}'
main.cpp(9): error C2143: syntax error : missing ';' before '}'
Also, on cout, IntelliSense gives me the error "no suitable conversion function from 'std::basic_ostream...' to 'int' exists". And on return it says "error: expected a declaration." That same error is also given on the final bracket.
Why am I getting all of these nonsense errors and how to I make them stop appearing so I can run a program?
(P.S. I have tried writing the program with and without "using namespace std" and nothing changes.)
Upvotes: 0
Views: 512
Reputation: 42889
You're missing parenetheses from main
:
#include <iostream>
using namespace std;
int main()
^^
{
cout << "Hello World!" << endl;
return 0;
}
Upvotes: 4