-
April 17th, 2012, 09:57 AM
#1
Not compiling typedef definition
Hello,
I´m migrating a VC++ 6.0 code to VS 2010. There is not compiling a file from Visual Studio itself: oaidl.h on the line
Code:
typedef CY CURRENCY;
line 226
it says:
1>c:\program files\microsoft sdks\windows\v7.0a\include\oaidl.h(226): error C2143: syntax error : missing ';' before 'constant'
1>c:\program files\microsoft sdks\windows\v7.0a\include\oaidl.h(226): error C2059: syntax error : 'constant'
any clue?
-
April 17th, 2012, 10:10 AM
#2
Re: Not compiling typedef definition
Originally Posted by michaelhsilva
...any clue?
Yes, some clues
Your error means that the type CY is not defined.
It *should* be defined in <WTypes.h>, included in <winscard.h>, that is in turn included in <windows.h>.
You could bypass any of these inclusions by using some preprocessor definitions.
My bet is – you have defined WIN32_LEAN_AND_MEAN. Did I win?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
April 17th, 2012, 10:32 AM
#3
Re: Not compiling typedef definition
Hello VladmirF, thank you for your post!
No, I´ve not defined WIN32_LEAN_AND_MEAN. I defined CY on WTypes.h but it appeared another errors:
1>c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(2): error C2143: syntax error : missing ';' before 'constant'
1>c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(1052): error C2371: 'CY' : redefinition; different basic types
1> c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(2) : see declaration of 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2071): error C2766: explicit specialization; 'ATL::_CVarTypeInfo<int>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(1839) : see previous definition of '_CVarTypeInfo<int>'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2073): error C2374: 'pmField' : redefinition; multiple initialization
1> c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(1842) : see declaration of 'pmField'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2081): error C2766: explicit specialization; 'ATL::_CVarTypeInfo<int*>' has already been defined
1> c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(1849) : see previous definition of '_CVarTypeInfo<int *>'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2083): error C2374: 'pmField' : redefinition; multiple initialization
1> c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(1852) : see declaration of 'pmField'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2465): error C2535: 'ATL::CComVariant &ATL::CComVariant:perator =(int)' : member function already defined or declared
1> c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2397) : see declaration of 'ATL::CComVariant:perator ='
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2216): error C2228: left of '.Hi' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2216): error C2228: left of '.Hi' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2217): error C2228: left of '.Lo' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2217): error C2228: left of '.Lo' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2471): error C2228: left of '.Hi' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2471): error C2228: left of '.Hi' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2472): error C2228: left of '.Lo' must have class/struct/union
1> type is 'CY'
1>c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atlcomcli.h(2472): error C2228: left of '.Lo' must have class/struct/union
1> type is 'CY'
this is very strange, a file of Visual Studio itself!
-
April 17th, 2012, 11:38 AM
#4
Re: Not compiling typedef definition
Originally Posted by michaelhsilva
... I defined CY on WTypes.h but it appeared another errors:
1>c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(2): error C2143: syntax error : missing ';' before 'constant'
What do you mean - "I defined"???
The type CY *IS* defined in <WTypes.h>, on line # 1051!
Line # 2 in that file has a comment.
Did you type something in yourself?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
April 17th, 2012, 11:59 AM
#5
Re: Not compiling typedef definition
Originally Posted by VladimirF
What do you mean - "I defined"???
I just put
Code:
typedef CY CURRENCY
on <WTypes.h>
Originally Posted by VladimirF
The type CY *IS* defined in <WTypes.h>, on line # 1051!
Yes, there really is.
Originally Posted by VladimirF
Line # 2 in that file has a comment.
Yes /* this ALWAYS GENERATED file contains the definitions for the interfaces */
Originally Posted by VladimirF
Did you type something in yourself?
I just put
Code:
typedef CY CURRENCY
on <WTypes.h>
-
April 17th, 2012, 12:14 PM
#6
Re: Not compiling typedef definition
Why are you editing a delivered include file?
You can't put the typedef before the definition of "CY".
Viggy
-
April 17th, 2012, 12:19 PM
#7
Re: Not compiling typedef definition
Hello MRViggy, thank you for your post!
I mean, this is a delivered file, why it has compilation errors?
-
April 17th, 2012, 12:22 PM
#8
Re: Not compiling typedef definition
You said:
Originally Posted by michaelhsilva
I defined CY on WTypes.h but it appeared another errors
and
Originally Posted by michaelhsilva
I just put
Code:
typedef CY CURRENCY
on <WTypes.h>
I took that to mean that you hand edited the file. The first three lines in your log lead me to believe that you had added the 'typedef' to the header file before the declaration of "CY".
Viggy
-
April 17th, 2012, 12:34 PM
#9
Re: Not compiling typedef definition
Yes, I set but then pulled off.
I have:
on wtypes.h:1053
and:
Code:
typedef CY CURRENCY;
on oaidl.h:226
The question is, why this latter is causing compilation errors?:
oaidl.h(226): error C2143: syntax error : missing ';' before 'constant'
oaidl.h(226): error C2059: syntax error : 'constant'
-
April 17th, 2012, 12:44 PM
#10
Re: Not compiling typedef definition
I made a simple application with the code:
Code:
#include "stdafx.h"
typedef CY; *LPCY;
typedef CY CURRENCY;
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
and it works!
-
April 17th, 2012, 02:02 PM
#11
Re: Not compiling typedef definition
but I´m still needing help on the main application... The error persists.
-
April 17th, 2012, 02:16 PM
#12
Re: Not compiling typedef definition
The error message looks like there might be some kind of pre-processor macro defined in one of your header files.
Viggy
-
April 17th, 2012, 02:20 PM
#13
Re: Not compiling typedef definition
Solution: changed for
Code:
typedef CY; //CURRENCY;
may be?
-
April 17th, 2012, 02:26 PM
#14
Re: Not compiling typedef definition
Originally Posted by michaelhsilva
Solution: changed for
Code:
typedef CY; //CURRENCY;
may be?
No. That line really says nothing. And, you shouldn't be modifying SDK header files, unless you wrote them. It seems like you might have something in one of your header files, not Windows header files, that might be changing CURRENCY to something else. If you add the compiler option "/E" you can see what the preprocessor is doing. Search the output for "CURRENCY".
Viggy
-
April 17th, 2012, 02:27 PM
#15
Re: Not compiling typedef definition
Originally Posted by michaelhsilva
The question is, why this latter is causing compilation errors?
As already stated, you are getting errors because you edited line 2 of WTypes.h, which is apparent from the compiler output:
Code:
1>c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(2): error C2143: syntax error : missing ';' before 'constant'
1>c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(1052): error C2371: 'CY' : redefinition; different basic types
1> c:\program files\microsoft sdks\windows\v7.0a\include\wtypes.h(2) : see declaration of 'CY'
Get a fresh copy of WTypes.h and try again with the unedited version.
Mike
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|