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. Type Conversion error while running C++ code in ubuntu

Type Conversion error while running C++ code in ubuntu

Scheduled Pinned Locked Moved C / C++ / MFC
c++comlinuxhelpworkspace
5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I am getting an Error while compiling `DESolver.cpp`

    DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
    DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
    calcTrialSolution = Best1Exp;

    Detailed Error is shown Here Complete Code

    R J 2 Replies Last reply
    0
    • L Lost User

      I am getting an Error while compiling `DESolver.cpp`

      DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
      DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
      calcTrialSolution = Best1Exp;

      Detailed Error is shown Here Complete Code

      R Offline
      R Offline
      Rick York
      wrote on last edited by
      #2

      This appears to me to be a call taking a pointer to a function - it wants a pointer and didn't getting one. Add an ampersand and see how that works for you. This is a shot in the dark though because I do not see the code in its context or the prototype declaration of the function call in question. In other words, if you had posted more of the code you would likely receive a better answer.

      CPalliniC 1 Reply Last reply
      0
      • R Rick York

        This appears to me to be a call taking a pointer to a function - it wants a pointer and didn't getting one. Add an ampersand and see how that works for you. This is a shot in the dark though because I do not see the code in its context or the prototype declaration of the function call in question. In other words, if you had posted more of the code you would likely receive a better answer.

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        Probably the ampersand will do the trick.

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • L Lost User

          I am getting an Error while compiling `DESolver.cpp`

          DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
          DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
          calcTrialSolution = Best1Exp;

          Detailed Error is shown Here Complete Code

          J Offline
          J Offline
          jeronimax
          wrote on last edited by
          #4

          Instead of

          calcTrialSolution = Best1Exp;

          you have to write

          calcTrialSolution = &DESolver::Best1Exp;

          (so for all case statements, of cause)

          L 1 Reply Last reply
          0
          • J jeronimax

            Instead of

            calcTrialSolution = Best1Exp;

            you have to write

            calcTrialSolution = &DESolver::Best1Exp;

            (so for all case statements, of cause)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Thanks It worked

            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