Ok I have a bug that is very hard to pinpoint. Upon Compilation I get

Compiling...
Forkin.cpp
\vc98\include\xlocale(467) : error C2059: syntax error : 'end of file'
ForkLift.cpp
MainWnd.cpp
\vc98\include\xlocale(467) : error C2059: syntax error : 'end of file'
Mat4f.cpp
Generating Code...
Error executing cl.exe.

Forkin.exe - 2 error(s), 0 warning(s)

I take it the Message is pointing to the xlocale include which is part of C++. I guess the error originates in Forkin.cpp and searched for missing tokens to no avail.
I would appreciate any info.
Thanks in advance
Dinobod

Dani AI

Generated

When MSVC points at a standard header (xlocale here) with C2059 "syntax error : 'end of file'", the real problem is almost always earlier in your own code. The compiler only notices the malformed token once it reaches a system include. Common root causes are: a missing ; after a class/struct/enum, a missing } or ), an unterminated /* comment or string literal, or a macro that expands to invalid tokens. These leave the parser in a half‑finished state and produce a baffling error inside a header file.

Two tiny examples showing how a small omission breaks later includes:

/* broken: missing semicolon after struct */
struct Foo {
    int x;
}   // <-- should be `};`
#include <string>
/* broken: unterminated comment */
 /* forgot to close comment
#include <vector>

Practical steps that quickly find the offender:

  • Generate the preprocessed file (cl /P Forkin.cpp) and inspect the end of the generated .i for unterminated constructs.
  • Narrow the problem with a binary search: comment out half the file (or recent changes) to see when the error disappears, then repeat.
  • Temporarily remove or reorder includes to discover which header causes the parser to fail.
  • Look for macros (#define) that might accidentally swallow semicolons or braces.
  • If posting for help, provide a minimal reproducible file plus the exact cl command and full error text — that yields faster, accurate diagnosis.

This matches what ultimately found (a malformed declaration) and explains why ’s request for the code was the right move. For long‑term avoidance, keep headers minimal (only prototypes or inline/template bodies), use header guards, and consider a newer compiler for clearer diagnostics if upgrading is an option.

Recommended Answers

All 3 Replies

post your code please :)

Ok I have a bug that is very hard to pinpoint. Upon Compilation I get

Thanks to all concerned. I got it figured. What I did was include a
Function header( not a class) and did not inline the Functions or
should I say didn't declare them well anyway It works now

Thanks again

Ok I have a bug that is very hard to pinpoint. Upon Compilation I get

Thanks to all concerned. I got it figured. What I did was include a
Function header( not a class) and did not inline the Functions or
should I say didn't declare them well anyway It works now

Thanks again

awesome


cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.