Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. errors C2065, C2501 and C2143

errors C2065, C2501 and C2143

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiohelp
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    caykahve
    wrote on last edited by
    #1

    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

    C D 2 Replies Last reply
    0
    • C caykahve

      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

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      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.

      N C D 3 Replies Last reply
      0
      • C Cedric Moonen

        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.

        C Offline
        C Offline
        caykahve
        wrote on last edited by
        #3

        I'm trying to use only some of the functions that i had used in my mfc application. this was only to show that they could be compiled. i am using a win32 console project now.

        1 Reply Last reply
        0
        • C Cedric Moonen

          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.

          N Offline
          N Offline
          Nemanja Trifunovic
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • C Cedric Moonen

            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.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            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

            C 1 Reply Last reply
            0
            • C caykahve

              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

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • D David Crow

                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

                C Offline
                C Offline
                Cedric Moonen
                wrote on last edited by
                #7

                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:

                D 1 Reply Last reply
                0
                • C Cedric Moonen

                  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:

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  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(), and CopyFile() would be limited to just GUI-based applications?


                  "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    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(), and CopyFile() would be limited to just GUI-based applications?


                    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                    C Offline
                    C Offline
                    Cedric Moonen
                    wrote on last edited by
                    #9

                    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...

                    D 1 Reply Last reply
                    0
                    • C Cedric Moonen

                      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...

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups