From: DamL on
Hi,

I have solutions that compile under VS2008 with no warning nor errors.
While porting them to VS2010 I've got this kind of behavior :

C:\Program Files\Microsoft Visual Studio
10.0\VC\atlmfc\include\afx.h(469): error C2146: syntax error : missing
';' before identifier 'AfxCrtErrorCheck'

etc., all related to VS2010 own files and mainly related to types
definitions.

Our solutions are using mfc.

What's wrong with VS2010 while compiling ?


From: Bo Persson on
DamL wrote:
> Hi,
>
> I have solutions that compile under VS2008 with no warning nor
> errors. While porting them to VS2010 I've got this kind of behavior
> :
> C:\Program Files\Microsoft Visual Studio
> 10.0\VC\atlmfc\include\afx.h(469): error C2146: syntax error :
> missing ';' before identifier 'AfxCrtErrorCheck'
>
> etc., all related to VS2010 own files and mainly related to types
> definitions.
>
> Our solutions are using mfc.
>
> What's wrong with VS2010 while compiling ?

Probably nothing wrong there. :-)

The symbol immediately before 'AfxCrtErrorCheck' is errno_t. You don't
have a macro redefining that, do you? Or some unusual way of including
the header files?


Bo Persson


From: Joseph M. Newcomer on
See below...
On Tue, 08 Jun 2010 15:05:01 +0200, DamL <damien.lebrun(a)cynove.com> wrote:

>Hi,
>
>I have solutions that compile under VS2008 with no warning nor errors.
>While porting them to VS2010 I've got this kind of behavior :
>
>C:\Program Files\Microsoft Visual Studio
>10.0\VC\atlmfc\include\afx.h(469): error C2146: syntax error : missing
>';' before identifier 'AfxCrtErrorCheck'
****
Whenever you see something like this, the first thing to do is examine the line involved.

The text is:

inline errno_t AfxCrtErrorCheck(errno_t error)

which tells you immediately that the word errno_t is not defined, and therefore is not
known to be a type, resulting in a syntax error.

You did not tell us where the #include <afx.h> occurs, or what precedes it, or what
follows it.

The afx.h file includes <errno.h> up towards its front. This can suggest that perhaps you
are getting the wrong file, perhaps from some older library header set.

A technique that can be used to determine exactly what happened is to use the /P
compilation option (there's a property, and I'm not sure where it is in 2010, that sets
this, or you can hand-edit this option into the command line for the file that is
producing the problem; note that this is case-sensitive, and must be /P, not /p)

The result is a .i file in the source directory, which is the expanded text from the
preprocessor. Now locate the above line that defines AfxCrtErrorCheck. See what it says
(note: the file will be huge, hundreds of thousands of lines). If it says errno_t, then
search backwards from this line looking for

typedef int errno_t

which should be in the file crtdefs.h.

If you don't find it, that's what is wrong. Go look to see where crtdefs.h is included
(it is included by errno.h). You should see the whole path displayed.

It sounds like, just at a first guess, you have messed up your search paths and are
getting some incorrect file, so the symbol errno_t is not being properly defined. But as
to why this is, without having the ability to poke around on your running version of
VS2010, there's no easy way to find it from where I sit. But you can look.
joe
****
>
>etc., all related to VS2010 own files and mainly related to types
>definitions.
>
>Our solutions are using mfc.
>
>What's wrong with VS2010 while compiling ?
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: DamL on
Hi,
problem is now solved : I've reincluded the root VS2010 inc/lib and same
for VS2010 atlmfc inc/lib directories into "VC++ directories" option of
project itself and it now compiles and links.
Execution is also correct.