编译错误error C2370: 'THIS_FILE' : redefinition的解决方法

本文解决了一个关于在项目中重新引入AboutBox时遇到的编译错误问题。错误源于头文件与源文件之间的不当包含,通过移除MainFrm.cpp中不必要的AboutDlg.cpp包含声明解决了该问题。
部署运行你感兴趣的模型镜像
某工程以前是有AboutBox的,后来被去掉了。近日在其中加入AboutBox,不想碰到如下错误:
--------------------Configuration: MSNLike_dll - Win32 Debug--------------------
Compiling...
MainFrm.cpp
e:/work/messangerinterface/msnlike_dll/msnlike_dll/aboutdlg.cpp(10) : error C2370: 'THIS_FILE' : redefinition; different storage class
        E:/work/MessangerInterface/msnlike_dll/MSNLike_dll/MainFrm.cpp(12) : see declaration of 'THIS_FILE'
Error executing cl.exe.

MSNLike_dll.dll - 1 error(s), 0 warning(s)

网上仔细搜索,发现很少有解决方法,经仔细排查后发现原来是这个问题:
在Mainfrm.cpp中误加入下面语句所致
#include "AboutDlg.cpp"

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

arp_final.c:16:0: warning: "IFNAMSIZ" redefined #define IFNAMSIZ 16 ^ In file included from arp_final.c:7:0: /usr/include/net/if.h:129:0: note: this is the location of the previous definition # define IFNAMSIZ IF_NAMESIZE ^ arp_final.c:68:8: error: redefinition of ‘struct ifreq’ struct ifreq { ^ In file included from arp_final.c:7:0: /usr/include/net/if.h:126:8: note: originally defined here struct ifreq ^ arp_final.c:69:10: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token char ifr_name[IFNAMSIZ]; ^ arp_final.c: In function ‘if_nametoindex’: arp_final.c:125:16: error: ‘struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); ^ arp_final.c:134:15: error: ‘struct ifreq’ has no member named ‘ifr_ifru’ return ifr.ifr_ifru.ifru_metric; ^ arp_final.c: In function ‘get_local_mac’: arp_final.c:146:16: error: ‘struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ); ^ arp_final.c:153:20: error: ‘struct ifreq’ has no member named ‘ifr_ifru’ memcpy(mac, ifr.ifr_ifru.ifru_hwaddr.sa_data, MAC_LENGTH); ^ arp_final.c: In function ‘get_local_ip’: arp_final.c:166:16: error: ‘struct ifreq’ has no member named ‘ifr_ifrn’ strncpy(ifr.ifr_name, ifname, IFNAMSIZ); ^ arp_final.c:173:57: error: ‘struct ifreq’ has no member named ‘ifr_ifru’ struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_ifru.ifru_addr; ^ arp_final.c: In function ‘build_arp_packet’: arp_final.c:191:25: error: ‘ETH_P_IP’ undeclared (first use in this function) arp->ar_pro = htons(ETH_P_IP); ^ arp_final.c:191:25: note: each undeclared identifier is reported only once for each function it appears in arp_final.c: In function ‘send_arp’: arp_final.c:230:12: error: variable ‘dest’ has initializer but incomplete type struct sockaddr_ll dest = { ^ arp_final.c:231:9: error: unknown field ‘sll_family’ specified in initializer .sll_family = AF_PACKET, ^ arp_final.c:232:9: error: unknown field ‘sll_protocol’ specified in initializer .sll_protocol = htons(ETH_P_ARP), ^ arp_final.c:232:25: warning: excess elements in struct initializer .sll_protocol = htons(ETH_P_ARP), ^ arp_final.c:232:25: note: (near initialization for ‘dest’) arp_final.c:233:9: error: unknown field ‘sll_ifindex’ specified in initializer .sll_ifindex = if_nametoindex(ifname), ^ arp_final.c:233:24: warning: excess elements in struct initializer .sll_ifindex = if_nametoindex(ifname), ^ arp_final.c:233:24: note: (near initialization for ‘dest’) arp_final.c:234:9: error: unknown field ‘sll_halen’ specified in initializer .sll_halen = ETH_ALEN, ^ arp_final.c:24:18: warning: excess elements in struct initializer #define ETH_ALEN 6 ^ arp_final.c:234:22: note: in expansion of macro ‘ETH_ALEN’ .sll_halen = ETH_ALEN, ^ arp_final.c:24:18: note: (near initialization for ‘dest’) #define ETH_ALEN 6 ^ arp_final.c:234:22: note: in expansion of macro ‘ETH_ALEN’ .sll_halen = ETH_ALEN, ^ arp_final.c:235:9: error: unknown field ‘sll_addr’ specified in initializer .sll_addr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} // 广播地址 ^ arp_final.c:235:21: error: extra brace group at end of initializer .sll_addr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} // 广播地址 ^ arp_final.c:235:21: note: (near initialization for ‘dest’) arp_final.c:235:21: warning: excess elements in struct initializer arp_final.c:235:21: note: (near initialization for ‘dest’) arp_final.c:230:24: error: storage size of ‘dest’ isn’t known struct sockaddr_ll dest = { ^ arp_final.c: In function ‘find_or_create_node’: arp_final.c:275:5: warning: implicit declaration of function ‘list_for_each’ [-Wimplicit-function-declaration] list_for_each(pos, &arp_result_head) { ^ arp_final.c:275:42: error: expected ‘;’ before ‘{’ token list_for_each(pos, &arp_result_head) { ^ arp_final.c: In function ‘cleanup_thread’: arp_final.c:373:9: warning: implicit declaration of function ‘list_for_each_safe’ [-Wimplicit-function-declaration] list_for_each_safe(pos, next, &arp_result_head) { ^ arp_final.c:373:57: error: expected ‘;’ before ‘{’ token list_for_each_safe(pos, next, &arp_result_head) { ^ arp_final.c: In function ‘print_arp_table’: arp_final.c:403:42: error: expected ‘;’ before ‘{’ token list_for_each(pos, &arp_result_head) { 报错如上
08-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值