errors C2065, C2501 and C2143
-
Hi, I'm trying to use some of the functions I was using in an MFC application in a console application. I've created a console application with Visual Studio.Net 2003. Looks like I am missing some header(s). however i cannot find out which. I have added and tried all the header files i can think of. These are my include files: //---------------------------------------- #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include // my include files // ... #include "stdafx.h" using namespace std; //---------------------------------------- output: ******************************************* ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\SetupAPI.h(56) : error C2143: syntax error : missing ';' before ... ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(30) : error C2501: 'HRESULT' : missing storage-class or type specifiers ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2065: 'CALLBACK' : undeclared identifier ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2501: 'UINT' : missing storage-class or type specifiers ... ... ******************************************* It looks so strange. I will be very happy if someone can suggest a solution. Thanks in advance
-
Hi, I'm trying to use some of the functions I was using in an MFC application in a console application. I've created a console application with Visual Studio.Net 2003. Looks like I am missing some header(s). however i cannot find out which. I have added and tried all the header files i can think of. These are my include files: //---------------------------------------- #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include // my include files // ... #include "stdafx.h" using namespace std; //---------------------------------------- output: ******************************************* ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\SetupAPI.h(56) : error C2143: syntax error : missing ';' before ... ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(30) : error C2501: 'HRESULT' : missing storage-class or type specifiers ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2065: 'CALLBACK' : undeclared identifier ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2501: 'UINT' : missing storage-class or type specifiers ... ... ******************************************* It looks so strange. I will be very happy if someone can suggest a solution. Thanks in advance
caykahve wrote: I'm trying to use some of the functions I was using in an MFC application in a console application :omg: Using MFC in a console application ???? It is simply impossible to do that. MFC are (in majority) wrapper classes around the Win32 API thus it is purely a Win32 application.
-
caykahve wrote: I'm trying to use some of the functions I was using in an MFC application in a console application :omg: Using MFC in a console application ???? It is simply impossible to do that. MFC are (in majority) wrapper classes around the Win32 API thus it is purely a Win32 application.
-
caykahve wrote: I'm trying to use some of the functions I was using in an MFC application in a console application :omg: Using MFC in a console application ???? It is simply impossible to do that. MFC are (in majority) wrapper classes around the Win32 API thus it is purely a Win32 application.
cedric moonen wrote: Using MFC in a console application ???? It is simply impossible to do that. It is possible.[^]
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
caykahve wrote: I'm trying to use some of the functions I was using in an MFC application in a console application :omg: Using MFC in a console application ???? It is simply impossible to do that. MFC are (in majority) wrapper classes around the Win32 API thus it is purely a Win32 application.
cedric moonen wrote: It is simply impossible to do that. :confused: It is simply very easy to do that. What makes you think it is impossible?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
Hi, I'm trying to use some of the functions I was using in an MFC application in a console application. I've created a console application with Visual Studio.Net 2003. Looks like I am missing some header(s). however i cannot find out which. I have added and tried all the header files i can think of. These are my include files: //---------------------------------------- #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include // my include files // ... #include "stdafx.h" using namespace std; //---------------------------------------- output: ******************************************* ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\SetupAPI.h(56) : error C2143: syntax error : missing ';' before ... ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\CommCtrl.h(30) : error C2501: 'HRESULT' : missing storage-class or type specifiers ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2065: 'CALLBACK' : undeclared identifier ... \Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\PrSht.h(97) : error C2501: 'UINT' : missing storage-class or type specifiers ... ... ******************************************* It looks so strange. I will be very happy if someone can suggest a solution. Thanks in advance
Notice anything pecular about your post? I'll give you a hint: we can't see the names of the header files. Either check the "Do not treat <'s as HTML tags" checkbox, or use the < and > located above the smileys. That said, you might want to include
windows.h
before any of the others.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
cedric moonen wrote: It is simply impossible to do that. :confused: It is simply very easy to do that. What makes you think it is impossible?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Can you use the Win32 API in a console application ?? This seems something really strange to me. Or at least I never heard about that :doh:
-
Can you use the Win32 API in a console application ?? This seems something really strange to me. Or at least I never heard about that :doh:
cedric moonen wrote: Can you use the Win32 API in a console application ?? Of course, that is a very common thing to do. Why would you think functions like
lstrcpy()
,ZeroMemory()
,RegOpenKeyEx()
, andCopyFile()
would be limited to just GUI-based applications?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
cedric moonen wrote: Can you use the Win32 API in a console application ?? Of course, that is a very common thing to do. Why would you think functions like
lstrcpy()
,ZeroMemory()
,RegOpenKeyEx()
, andCopyFile()
would be limited to just GUI-based applications?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
Mmmhh, yes for that I agree... But everything related to window management cannot be used in console application, am I right ? And so, a big part of the MFC cannot be used neither. But ok, it doesn't mean that nothing can be used...
-
Mmmhh, yes for that I agree... But everything related to window management cannot be used in console application, am I right ? And so, a big part of the MFC cannot be used neither. But ok, it doesn't mean that nothing can be used...
cedric moonen wrote: But everything related to window management cannot be used in console application, am I right ? Correct. cedric moonen wrote: And so, a big part of the MFC cannot be used neither. I guess that depends on your definition of "big part." Here is a map of the MFC library that I use. I would not say that a "big part" of the classes were windows-specific. Of the 129 classes shown, about 94 of them can be used in console and GUI applications.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown