Skip to content
QtWS25 Last Chance
  • 0 Votes
    9 Posts
    9k Views
    J
    @Chris-Kawa Hi, Mr. Chris-Kawa. Yes, I had enabled the c++11 by adding QMAKE_CXXFLAGS += -std=c++11 into my .pro file, so this isn't the real problem. Finally my code has passed the compiling, by adding ## as the prefix of macro __VA_ARGS__. I think there are multiple errors in my first version of code that bothered me and covered the real problem : In struct RuntimeClass, I took a return type to the member pointer of function which is different with the function I filled to that member; In class TestClass , I didn't declare the member function TestFunc as static. This cause the member function has a different type with RuntimeClass::m_pfnFunction, and make compiler report error on filling it into instance of RuntimeClass In the macros DECL_RUNTIMECLASS and IMPL_RUNTIMECLASS, I didn't prefix macro __VA_ARGS__ with ##. This make a redundant comma be left in template parameter list after macro expansion, which will cause the compiling error of template argument 2 is invalid. The source code you corrected notified me the above two problems. And with your selfless help I finally sovled the compiling error in my design! Thank you very much !