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. Error while compiling

Error while compiling

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 3 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.
  • U Offline
    U Offline
    User 10909830
    wrote on last edited by
    #1

    error C2440: 'static_cast' : cannot convert from 'void (__thiscall COptionDBTransport::* )(PCTSTR)' to 'AFX_PMSG'

    Throws error at this line-

    ON_BN_CLICKED(IDC_BUTTON_udpCheck, &COptionDBTransport::OnBnClickedButtonudpcheck)

    Please help me for this issue.

    P M 2 Replies Last reply
    0
    • U User 10909830

      error C2440: 'static_cast' : cannot convert from 'void (__thiscall COptionDBTransport::* )(PCTSTR)' to 'AFX_PMSG'

      Throws error at this line-

      ON_BN_CLICKED(IDC_BUTTON_udpCheck, &COptionDBTransport::OnBnClickedButtonudpcheck)

      Please help me for this issue.

      P Offline
      P Offline
      pasztorpisti
      wrote on last edited by
      #2

      Seemingly your only problem is that your method signature doesn't match. See the AFX_PMSG[^] signature. You method receives a PCTSTR parameter while a button event handler should be a method without any parameters.

      U 1 Reply Last reply
      0
      • U User 10909830

        error C2440: 'static_cast' : cannot convert from 'void (__thiscall COptionDBTransport::* )(PCTSTR)' to 'AFX_PMSG'

        Throws error at this line-

        ON_BN_CLICKED(IDC_BUTTON_udpCheck, &COptionDBTransport::OnBnClickedButtonudpcheck)

        Please help me for this issue.

        M Offline
        M Offline
        Mike Nordell
        wrote on last edited by
        #3

        Does your COptionDBTransport inherit from CCmdTarget (or a derived type of it)? Have you included (even if indirectly) ? (ON_BN_CLICKED is defined in another header)

        U 1 Reply Last reply
        0
        • M Mike Nordell

          Does your COptionDBTransport inherit from CCmdTarget (or a derived type of it)? Have you included (even if indirectly) ? (ON_BN_CLICKED is defined in another header)

          U Offline
          U Offline
          User 10909830
          wrote on last edited by
          #4

          Thanks, Yes Have inculded the header file.

          M 1 Reply Last reply
          0
          • P pasztorpisti

            Seemingly your only problem is that your method signature doesn't match. See the AFX_PMSG[^] signature. You method receives a PCTSTR parameter while a button event handler should be a method without any parameters.

            U Offline
            U Offline
            User 10909830
            wrote on last edited by
            #5

            Yes ,it is inherited from CCmdTarget(base class of all classes used) M still stuck to that error @pasztorpisti-How to pass multiple parameters to a button event handler.

            P 1 Reply Last reply
            0
            • U User 10909830

              Yes ,it is inherited from CCmdTarget(base class of all classes used) M still stuck to that error @pasztorpisti-How to pass multiple parameters to a button event handler.

              P Offline
              P Offline
              pasztorpisti
              wrote on last edited by
              #6

              You can not pass a parameter to a button event handler. You have to gather the data in the handler - for example by querying textboxes/checkboxes/etc in your handler method.

              U 1 Reply Last reply
              0
              • P pasztorpisti

                You can not pass a parameter to a button event handler. You have to gather the data in the handler - for example by querying textboxes/checkboxes/etc in your handler method.

                U Offline
                U Offline
                User 10909830
                wrote on last edited by
                #7

                thanks pasztorpisti, will try that.

                1 Reply Last reply
                0
                • U User 10909830

                  Thanks, Yes Have inculded the header file.

                  M Offline
                  M Offline
                  Mike Nordell
                  wrote on last edited by
                  #8

                  Then I'm totally baffled. Recommend you compile with /P (preprocess to file) and then, from a command-prompt try to compile that generated file. It should contain #line directives and such making it (hopefully) obvious why it fails. ++luck;

                  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