c++ compile error in codechef.com
I am trying to submit the solution of Adding Least Common Multiples(July contest) in codechef.com.
But
After submission I have got an error
/sources/tested.cpp:1: error: expected unqualified-id before numeric constant
what is it mean?
I did not get any error when I compiled in ec开发者_StackOverflow中文版lipse(helios) using mingw32-g++
Can you copy paste your line of code which is causing this error?
This can happen for various reasons.
- There can be name collisions wherein you decalare some variable which conflicts with some preprocessor constant.
- Passing references to temporary objects as parameters wherein the function expects a reference to some class.
- Sometimes it happens that the editors that you use introduce line numbers in the source files and when you copy your code from that editor the line numbers get copied too. I guess this may be a reason in your case. Try uploading your file option rather than pasting your code.
General guidelines to avoid such errors:
All uppercase names are often used for preprocessor macros, which do not respect namespace scopes. Therefore such names should generally be avoided for everything else.
Use GCC for local compilation.
精彩评论