Quantcast
Channel: User David Z - Stack Overflow
Viewing all articles
Browse latest Browse all 49

Answer by David Z for C++ error question: Expected Unqualified-id

$
0
0

This probably comes from the word String in the arguments to your main() function. There is no class, function, variable, etc. named String known to the compiler, so it gives an error. You'll probably get the same error from this program:

int main() {    String s;    return 0;}

In this latter case, if you add a class named String, then you can get it to compile:

class String {};int main() {    String s;    return 0;}

As cigien mentioned in the comments, your code looks like Java code and is not valid C++, so you'll have a lot more things to fix before you can get it to compile. Fixing all those things is beyond the scope of this site. I just mentioned the likely cause of the one error you asked about.


Viewing all articles
Browse latest Browse all 49

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>