Parse?

Started by
15 comments, last by dchar3 20 years, 10 months ago
whenever i try to compile my program, i get a parse error. What is it and how can i fix it?
Advertisement
quote:Original post by dchar3
whenever i try to compile my program, i get a parse error. What is it and how can i fix it?

How are we supposed to know if you don''t give us any details? Post the code causing the error, tell us what language it is, what compiler you are using, and what the error message is (and which line it refers to).
What that means is you ahve some kind of _syntax_ error- that is, your program is missing something that should be there, or it has something that should NOT be there.
~V'lionBugle4d
[Removed. Please go to the General Programming forum for that, it is inappropriate to post it here]

[edited by - michalson on May 28, 2003 12:37:32 PM]
Quite a common and easy parse error to make is leaving out a closing function brace. For example:

int main()
{
...

return 0;

<-- no curly brace '}'


But, as SabreMan basically said, we can only make guesses if you don't provide source code, which wastes not only our time, but yours too.

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on May 28, 2003 12:44:32 PM]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
here it is, due to popular demand, the source code for Dev C++ 4 compiler! but i dont think its exactly right.remember im a beginner so im just trying things to see how they work.

int main()
{
cout << "I cant remember this part";
}
quote:Original post by dchar3
here it is, due to popular demand, the source code for Dev C++ 4 compiler! but i dont think its exactly right.remember im a beginner so im just trying things to see how they work.

int main()
{
cout << "I cant remember this part";
}

first off, that''s not a parse error.. int main() must return a value.
also- there are no other "parse" errors in that code.
if you dont post the code verbatem, then you''re pissing in the metaphorical wind.


-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

-eldee;another space monkey;[ Forced Evolution Studios ]
That should work, so long as you have the two lines:

#include <iostream>
using namespace std;

at the top of your file. Incidently, you should return an integer from main(), but it will still work as the standard says to implicitly return 0.

Try this instead:

#include <iostream>
#include <cstdlib>

int main()
{
std::cout << "I am testing my compiler!\n\n";
system("PAUSE");

return 0;
}

Also, it seems that that is a rather old version of Dev-C++ (unless you have made a typo) you might want to download the latest.

Edit: Damn you, fast people!

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on May 28, 2003 1:04:08 PM]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
quote:Original post by eldee
first off, that''s not a parse error.. int main() must return a value.

Sort of. main() must indeed return a value, but keep in mind that if the main() function does not explicitly return a value, it will implicitly return 0 once control reaches the end of the function.

quote:
also- there are no other "parse" errors in that code.
if you dont post the code verbatem, then you''re pissing in the metaphorical wind.

Unless -- and this is, of course, a guess -- he forgot to #include the proper header:
#include <iostream>using namespace std; // Good for newbies ... 
quote:Original post by dchar3
here it is, due to popular demand, the source code for Dev C++ 4 compiler! but i dont think its exactly right.

If it was exactly right, you wouldn''t be posting about a problem!
quote:
int main()
{
cout << "I cant remember this part";
}

Please post the *exact* code along with the message that your compiler produces. At the very least, you need to include iostream and namespace-qualify cout.
quote:Original post by eldee
first off, that''s not a parse error.. int main() must return a value.

Unlike other functions, main() does not have to return a value. If no value is returned, the compiler should insert a "return 0" on your behalf.
quote:
also- there are no other "parse" errors in that code.

Well, there''s no headers, but until the OP posts what I asked for, he''s wasting everyone''s time.

This topic is closed to new replies.

Advertisement