[英]Resolving a “ cannot define member function … within ..”
I have been struggling with this issue for a while and I would like to know a systematic way of figuring out why I might be getting this error. 我已经为这个问题苦苦挣扎了一段时间了,我想知道一种系统的方法来弄清楚为什么我会遇到这个错误。 Apparently I have multiple components in my solution.
显然,我的解决方案中包含多个组件。 I am getting this error when I attempt to build one of my components.
尝试构建我的组件之一时出现此错误。
error: cannot define member function 'ImageFramework::ACE_Main::run_i' within 'ImageFramework'
In file included from C:\mingw64\required\ACE\ACE_wrappers/ace/config-all.h:89:0,
from C:\windows-libs\corba\ACE_wrappers\TAO\orbsvcs/orbsvcs/CosNamingC.h:37,
from C:\Users\UserAdmin\TreeShell\MainProcess\SourceCode\ExternalCommunication\CORBA/TCorbaClient.h:12,
from C:\Users\UserAdmin\TreeShell\MainProcess\SourceCode\ExternalCommunication/SystemCommunicator.h:23,
from C:\Users\UserAdmin\TreeShell\MainProcess\SourceCode\ApplicationManager\ApplMngExternalComm.h:18,
from C:\Users\UserAdmin\TreeShell\MainProcess\SourceCode\ApplicationManager\ApplMngMessageHandler.h:15,
from C:\Users\UserAdmin\TreeShell\MainProcess\SourceCode\ApplicationManager\ApplMngMessageHandler.cpp:15:
C:\mingw64\required\ACE\ACE_wrappers/ace/OS_main.h:218:51: error: cannot define member function 'ImageFramework::ACE_Main::run_i' within 'ImageFramework'
inline int ACE_Main::run_i (int argc, char *argv[]) \
A little background the component uses an external library called ace and the error lands me in an ace source file (which i am hesitant to touch as its not a part of my project). 稍微了解一下背景,该组件使用了一个称为ace的外部库,并且该错误使我进入了ace源文件(我很犹豫,因为它不是我的项目的一部分)。 Which is something like this
这是这样的
# define main \
ace_main_i (int, char *[]); \
ACE_BEGIN_VERSIONED_NAMESPACE_DECL \
ACE_Export int ace_os_main_i (ACE_Main_Base&, int, char *[]); \
class ACE_Main : public ACE_Main_Base {int run_i (int, char *[]);}; \
inline int ACE_Main::run_i (int argc, char *argv[]) \
{ \
return ace_main_i (argc, argv); \
} \
ACE_END_VERSIONED_NAMESPACE_DECL \
int \
ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., wmain */ \
{ \
ACE_Main m; \
return m.run (argc, argv); /*ace_os_main_i (m, argc, argv); what the user calls "main" */ \
} \
int \
ace_main_i
# endif /* ACE_WIN32 && ACE_USES_WCHAR */
# else /* ACE_HAS_WINCE */
Anyways here is what I have tried for the above mentioned error message error so 无论如何,这是我为上述错误消息错误尝试过的内容,因此
error: cannot define member function 'ImageFramework::ACE_Main::run_i' within 'ImageFramework'
I have looked through the ImagFramework
class source .h
and .cpp
which has multiple include files. 我浏览了
ImagFramework
类源.h
和.cpp
,它具有多个包含文件。 (Furthermore this class acts as a base class to many other classes) to see if an ace library header was included however I could not find any. (此外,该类还充当许多其他类的基类),以查看是否包含了ace库头,但是我找不到任何头。 I would appreciate suggestions on what might be a systematic approach on finding out what might be causing this issue .
我希望您能提出什么系统的方法来找出可能导致此问题的建议。 I might even be wrong interpreting this message.
我什至在解释此消息时可能是错误的。 My understanding of this message is that possibly a method in the
imageframework
class or a method in its base class might be triggering the above part of the code. 我对此消息的理解是,
imageframework
类中的一个方法或其基类中的一个方法可能会触发代码的上述部分。 Please correct me if I am wrong ? 如果我错了,请纠正我? Any suggestions ideas on this issue would be appreciated.
任何建议的想法在这个问题上将不胜感激。 Are there any other reasons why i might be getting this ?
还有其他原因为什么我会得到这个?
It looks like ImageFramework
class has a member called main
. 看起来
ImageFramework
类具有一个名为main
的成员。 So the macro #define main ace_main_i ...
expands and gives the error. 因此宏
#define main ace_main_i ...
展开并给出错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.