two or more data types in declaration of `main'

#include <iostream>
#pragma pack(8)
using std::cout;
using std::endl;
struct example1
{
short a;
long b;
}

struct example2
{
char c;
example1 struct1;
short e;
}

#pragma pack()
int main()
{
example2 struct2;
cout
<<(unsigned int)(&struct2.struct1)-(unsigned int)(&struct2);
system(
"pause");
return 0;
}

struct结构后面缺少;符号错误

转载于:https://www.cnblogs.com/vcyuyan/articles/1747221.html

CC networking/netmsg.o In file included from /home/tplink/code/be900v2/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be900v2/usr/include/rpc/types.h:36, from /home/tplink/code/be900v2/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be900v2/usr/include/rpc/netdb.h:45, from /home/tplink/code/be900v2/bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/arm-buildroot-linux-gnueabi/sysroot/usr/include/netdb.h:32, from networking/netmsg.c:23: include/platform.h:289:13: error: two or more data types in declaration specifiers 289 | typedef int smallint; | ^~~~~~~~ In file included from include/libbb.h:13, from include/busybox.h:8, from networking/netmsg.c:27: include/platform.h:289:1: warning: useless type name in empty declaration 289 | typedef int smallint; | ^~~~~~~ networking/netmsg.c:32:5: warning: no previous prototype for 'netmsg_main' [-Wmissing-prototypes] 32 | int netmsg_main(int argc, char **argv) | ^~~~~~~~~~~ networking/netmsg.c: In function 'netmsg_main': networking/netmsg.c:59:14: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness [-Wpointer-sign] 59 | strncpy(buf + 2, argv[2], 998); | ~~~~^~~ | | | unsigned char * In file included from networking/netmsg.c:26: /home/tplink/code/be900v2/bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/arm-buildroot-linux-gnueabi/sysroot/usr/include/string.h:128:40: note: expected 'char * restrict' but argument is of type 'unsigned char *' 128 | extern char *strncpy (char *__restrict __dest, | ~~~~~~~~~~~~~~~~~^~~~~~ scripts/Makefile.build:197: recipe for target 'networking/netmsg.o' failed make[5]: *** [networking/netmsg.o] Error 1 Makefile:744: recipe for target 'networking' failed
最新发布
11-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值