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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Pointer to function as arguments in visual c++

Pointer to function as arguments in visual c++

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpquestion
3 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.
  • D Offline
    D Offline
    dodoxor
    wrote on last edited by
    #1

    hi..i've a problem with a prject in Visual c++...i've this class: class A{ public: A(); void jpeg_received(jpg_t* jpg); void exit_capturing(int code); int rec(void); public: camaddr_t camaddr; CAPID capid; }; A::A() {...} void A::jpeg_received(jpg_t* jpg) {....//code to save a file jpg...} void A::exit_capturing(int code) {....//code to print a result for code's value...} int A::rec(void) {....... capid=ccap_start_capturing(&camaddr,jpeg_received,exit_capturing); ..........} I've to pass to ccap_start_capturing (function defined in a 'c file' of another project PUBLIC CAPID ccap_start_capturing(camaddr_t* camaddr, void(*jpeg_received)(jpg_t* jpg), void(*exit_capturing)(int code) ) two function "jpeg_received" and "exit_capturing" but i've this compile error: .\A.cpp(114) : error C3867: 'A::jpeg_received': function call missing argument list; use '&A::jpeg_received' to create a pointer to member .\A.cpp(114) : error C3867: 'A::exit_capturing': function call missing argument list; use '&A::exit_capturing' to create a pointer to member Can anyone help me? Thanks, regards.

    M S 2 Replies Last reply
    0
    • D dodoxor

      hi..i've a problem with a prject in Visual c++...i've this class: class A{ public: A(); void jpeg_received(jpg_t* jpg); void exit_capturing(int code); int rec(void); public: camaddr_t camaddr; CAPID capid; }; A::A() {...} void A::jpeg_received(jpg_t* jpg) {....//code to save a file jpg...} void A::exit_capturing(int code) {....//code to print a result for code's value...} int A::rec(void) {....... capid=ccap_start_capturing(&camaddr,jpeg_received,exit_capturing); ..........} I've to pass to ccap_start_capturing (function defined in a 'c file' of another project PUBLIC CAPID ccap_start_capturing(camaddr_t* camaddr, void(*jpeg_received)(jpg_t* jpg), void(*exit_capturing)(int code) ) two function "jpeg_received" and "exit_capturing" but i've this compile error: .\A.cpp(114) : error C3867: 'A::jpeg_received': function call missing argument list; use '&A::jpeg_received' to create a pointer to member .\A.cpp(114) : error C3867: 'A::exit_capturing': function call missing argument list; use '&A::exit_capturing' to create a pointer to member Can anyone help me? Thanks, regards.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      This should be posted on the Visual C++/MFC[^] board. The error messages state what needs to be done to get the address of a member function. Note that this still won't compile because the member functions are not declared static, which means there's an implicit "this" pointer passed to the methods. One way to get it to compile:

      class A
      {
      public:
      A();
      static void jpeg_received(jpg_t* jpg);
      static void exit_capturing(int code);
      int rec(void);
      public:
      camaddr_t camaddr;
      CAPID capid;
      };
      ...
      CAPID capid = ccap_start_capturing(..., &A::jpeg_received, &A::exit_capturing);

      Note that static methods cannot access non-static member variables/methods. Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      1 Reply Last reply
      0
      • D dodoxor

        hi..i've a problem with a prject in Visual c++...i've this class: class A{ public: A(); void jpeg_received(jpg_t* jpg); void exit_capturing(int code); int rec(void); public: camaddr_t camaddr; CAPID capid; }; A::A() {...} void A::jpeg_received(jpg_t* jpg) {....//code to save a file jpg...} void A::exit_capturing(int code) {....//code to print a result for code's value...} int A::rec(void) {....... capid=ccap_start_capturing(&camaddr,jpeg_received,exit_capturing); ..........} I've to pass to ccap_start_capturing (function defined in a 'c file' of another project PUBLIC CAPID ccap_start_capturing(camaddr_t* camaddr, void(*jpeg_received)(jpg_t* jpg), void(*exit_capturing)(int code) ) two function "jpeg_received" and "exit_capturing" but i've this compile error: .\A.cpp(114) : error C3867: 'A::jpeg_received': function call missing argument list; use '&A::jpeg_received' to create a pointer to member .\A.cpp(114) : error C3867: 'A::exit_capturing': function call missing argument list; use '&A::exit_capturing' to create a pointer to member Can anyone help me? Thanks, regards.

        S Offline
        S Offline
        sthotakura
        wrote on last edited by
        #3

        The following article may help you. http://msdn2.microsoft.com/en-us/library/b0x1aatf(VS.80).aspx[^]

        Cheers, Suresh

        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