I am using Red Hat Linux release 9 Kernel 2.4.20-8 on an i686 with gcc version 2.96. In my code I am declaring like,

std::locale utf8_locale;

I am getting this error:

syntax error before `;'

Please suggest me with a solution.

  • 2
    I'm not sure whether to upvote this because it's a clear question, or downvote it because it's asking about software that is well over ten years old, so I'm leaving it at ±0. – a CVn Sep 20 '13 at 8:11
  • 1
    @MichaelKjörling: Aw, don't beat up on the poor newbie. It wasn't that long ago that I had to back-port some recent software to FreeBSD 4. – Warren Young Sep 20 '13 at 9:16
  • @WarrenYoung That's why I didn't downvote. :) The question is most definitely clear, which (particularly coming from a newcomer to Stack Exchange) most definitely earns it a bonus point in my book. And I'm hoping my answer is helpful, even though it might not be exactly what the OP was hoping for. – a CVn Sep 20 '13 at 9:45

Linux 2.4.20 came out in November 2002.

GCC 3.0.4 came out in February 2002. There never was an official 2.96; 2.96 was an internal development version which is both forward and backward incompatible in its binary formats, and presumably was never guaranteed to work the way either GCC 2.95.x or 3.0 was.

Judging by the file dates on the ISOs, Red Hat Linux 9 was assembled in early 2003. Wikipedia agrees and claims a release date of March 31, 2003.

All of these are comparatively ancient.

I'm willing to bet that GCC's C++ support (both for namespaces and others, and almost certainly its C++ standard library) has been vastly improved in the last twelve or so years, and would strongly suggest that your first attempt at finding a solution should be to build your code using a more modern version of the compiler and standard library. Don't expect anything modern to build using a ten-plus-years old compiler (I'm not even sure std::locale hasn't been introduced since then).

If that does not help, you should look at the surrounding lines and any surrounding errors. Many times, an earlier error can throw the compiler off track causing it to spew out errors that really aren't there any more than as consequences of a past parse error. Fix any earlier errors before you tackle later ones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.