libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] MHD_Result casting error.


From: Jason Kary
Subject: [libmicrohttpd] MHD_Result casting error.
Date: Thu, 6 Aug 2020 14:41:38 -0400

Hello,

I’m hoping someone can help me understand how to fix the following error:

/home/jkary/src/xmrig-amd/src/common/api/Httpd.cpp: In member function ‘bool Httpd::start()’:
/home/jkary/src/xmrig-amd/src/common/api/Httpd.cpp:78:66: error: cannot convert ‘MHD_Result (Httpd::*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)’ to ‘MHD_AccessHandlerCallback’ {aka ‘MHD_Result (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)’}
   78 |     m_daemon = MHD_start_daemon(flags, m_port, nullptr, nullptr, &Httpd::handler, this, MHD_OPTION_END);
      |                                                                  ^~~~~~~~~~~~~~~
      |                                                                  |
      |                                                                  MHD_Result (Httpd::*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)
In file included from /home/jkary/src/xmrig-amd/src/common/api/Httpd.cpp:25:
/usr/include/microhttpd.h:2428:45: note:   initializing argument 5 of ‘MHD_Daemon* MHD_start_daemon(unsigned int, uint16_t, MHD_AcceptPolicyCallback, void*, MHD_AccessHandlerCallback, void*, ...)’
 2428 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
make[2]: *** [CMakeFiles/xmrig-amd.dir/build.make:876: CMakeFiles/xmrig-amd.dir/src/common/api/Httpd.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/xmrig-amd.dir/all] Error 2
make: *** [Makefile:104: all] Error 2
After a few days of experimenting I’m not able to grok the GNU c++ compiler error.  I can see the return type does not match and libmicrohttpd.h is expecting ‘MHD_Result (*)’ and some generous folks on reddit explained the return type is wrong because "Your function is expecting pointer to function, not a pointer to non-static member function.”

I am not quite strong enough in C++ (yet) to understand how to fix this issue.  I understand the cause but do not know how to fix this error.

Can anyone spend 5 minutes and educate me?

Thanks in advance!
Jason


reply via email to

[Prev in Thread] Current Thread [Next in Thread]