Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

dchar3

Parse?

This topic is 5525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

whenever i try to compile my program, i get a parse error. What is it and how can i fix it?

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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";
}

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 ...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!