我正在使用gcc版本4.4.1,xmake版本2.17.3。编译时出现以下错误。
`
In file included from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/os_include/net/os_if.h:28,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/OS_NS_sys_socket.h:29,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/ACE.inl:8,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/ACE.h:886,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/String_Base.cpp:6,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/String_Base.h:882,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/SString.h:23,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/CDR.h:61,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/UB_String_Argument_T.cpp:7,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/UB_String_Argument_T.h:177,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/Any_Insert_Policy_T.h:18,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/Basic_Arguments.h:25,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/IOPC.h:52,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/tao/Object.h:23,
from /rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/TAO/corba.h:39,
from ../../include/processors/chat/ms_chat.h:18,
from ../../include/processors/chat/forging.h:9,
from /home/akilis/ktph/leaf/src/ktph/processors/chat/src/forging.cpp:6:
/usr/include/net/if.h: At global scope:
/usr/include/net/if.h:99: error: template argument required for 'struct map'
`
我发现了solution这个问题。我按照建议在所有其他包含之前添加了<net/if.h>
。但它并没有解决问题。我仍然得到同样的错误。
我的../../include/processors/chat/forging.h:9
如下所示
`
9 #include "processors/chat/ms_chat.h"
10 #include <string>
11 // chat
12 #include <vector>
13 #include <gtcpp/mtlock.h>
14 #include <map>
15 //
16 #include "env/GenericMapper.h"
17
18 using namespace std;
`
然后/rtcigp/run/pd/ACE/6.0.7_x86/64Opt/include/ace/os_include/net/os_if.h:28
如下所示
`
27 #if !defined (ACE_LACKS_NET_IF_H)
28 # include /**/ <net/if.h>
29 # if defined (ACE_HAS_NET_IF_DL_H)
30 # include /**/ <net/if_dl.h>
31 # endif /* ACE_HAS_NET_IF_DL_H */
`
奇怪的是,这段代码在solaris CC中没有任何大惊小怪。只有当我使用gcc编译时,问题才会弹出。
我在这里遗漏了什么吗?从CC更改为gcc时,代码是否应该进行一些更改。或者这是gcc编译器中的一个错误,它已在更高版本中修复了吗?