GCC出现warning: integer constant is too large for 'long' type"

The warning message can be safely ignored, as mb-gcc is not doing anything wrong; the 64-bit computing is in fact correct.

This warning occurs because gcc is strict in syntax and requires LL on the end of such constants. This warning message disappears if the integer is appended with LL.

long long int test = 0x0008888000000000LL;

http://mazaoliang.blog.163.com/blog/static/138455093201151603823383/


root@ubuntu:/home/t101/paho.mqtt.c-master# make mkdir -p build/output/samples mkdir -p build/output/test echo OSTYPE is Linux OSTYPE is Linux sed -e "s/@CLIENT_VERSION@/1.3.0/g" -e "s/@BUILD_TIMESTAMP@/Thu Jun 19 06:23:05 PDT 2025/g" src/VersionInfo.h.in > build/VersionInfo.h arm-linux-gcc -g -fPIC -I/home/t101/sysdir/ssl/include/ -Os -Wall -Ibuild -o build/output/libpaho-mqtt3c.so.1.0 src/Heap.c src/Socket.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/SHA1.c src/StackTrace.c src/MQTTProperties.c src/MQTTPersistenceDefault.c src/MQTTPacketOut.c src/WebSocket.c src/Clients.c src/OsWrapper.c src/MQTTPacket.c src/Base64.c src/MQTTClient.c src/Log.c src/Thread.c src/LinkedList.c src/MQTTReasonCodes.c src/MQTTPersistence.c src/utf-8.c src/SocketBuffer.c src/Tree.c src/Messages.c -L/home/t101/sysdir/ssl/lib -shared -Wl,-init,MQTTClient_init -lpthread -Wl,-soname,libpaho-mqtt3c.so.1 src/SHA1.c: In function `SHA1_ProcessBlock': src/SHA1.c:112: warning: implicit declaration of function `__builtin_bswap32' src/WebSocket.c: In function `WebSocket_buildFrame': src/WebSocket.c:225: warning: implicit declaration of function `__builtin_bswap16' src/WebSocket.c:230: warning: integer constant is too large for "long" type src/WebSocket.c:230: warning: comparison is always true due to limited range of data type src/WebSocket.c:232: warning: implicit declaration of function `__builtin_bswap64' src/WebSocket.c: In function `WebSocket_calculateFrameHeaderSize': src/WebSocket.c:297: warning: integer constant is too large for "long" type src/WebSocket.c:297: warning: comparison is always true due to limited range of data type ln -s libpaho-mqtt3c.so.1.0 build/output/libpaho-mqtt3c.so.1 ln -s libpaho-mqtt3c.so.1 build/output/libpaho-mqtt3c.so arm-linux-gcc -g -fPIC -I/home/t101/sysdir/ssl/include/ -Os -Wall -Ibuild -o build/output/libpaho-mqtt3cs.so.1.0 src/Heap.c src/Socket.c src/SSLSocket.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/SHA1.c src/StackTrace.c src/MQTTProperties.c src/MQTTPersistenceDefault.c src/MQTTPacketOut.c src/WebSocket.c src/Clients.c src/OsWrapper.c src/MQTTPacket.c src/Base64.c src/MQTTClient.c src/Log.c src/Thread.c src/LinkedList.c src/MQTTReasonCodes.c src/MQTTPersistence.c src/utf-8.c src/SocketBuffer.c src/Tree.c src/Messages.c -DOPENSSL -L/home/t101/sysdir/ssl/lib -shared -Wl,--start-group -lpthread -ldl -lssl -lcrypto -Wl,--end-group -Wl,-init,MQTTClient_init -Wl,-soname,libpaho-mqtt3cs.so.1 -Wl,-no-whole-archive src/SSLSocket.c: In function `SSLSocket_createContext': src/SSLSocket.c:537: warning: `TLSv1_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1866) src/SSLSocket.c:542: warning: `TLSv1_1_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1872) src/SSLSocket.c:547: warning: `TLSv1_2_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1878) src/SSLSocket.c: In function `SSLSocket_initialize': src/SSLSocket.c:476: warning: statement with no effect src/WebSocket.c: In function `WebSocket_buildFrame': src/WebSocket.c:225: warning: implicit declaration of function `__builtin_bswap16' src/WebSocket.c:230: warning: integer constant is too large for "long" type src/WebSocket.c:230: warning: comparison is always true due to limited range of data type src/WebSocket.c:232: warning: implicit declaration of function `__builtin_bswap64' src/WebSocket.c: In function `WebSocket_calculateFrameHeaderSize': src/WebSocket.c:297: warning: integer constant is too large for "long" type src/WebSocket.c:297: warning: comparison is always true due to limited range of data type ln -s libpaho-mqtt3cs.so.1.0 build/output/libpaho-mqtt3cs.so.1 ln -s libpaho-mqtt3cs.so.1 build/output/libpaho-mqtt3cs.so arm-linux-gcc -g -fPIC -I/home/t101/sysdir/ssl/include/ -Os -Wall -Ibuild -o build/output/libpaho-mqtt3a.so.1.0 src/Heap.c src/Socket.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/MQTTAsync.c src/SHA1.c src/StackTrace.c src/MQTTProperties.c src/MQTTPersistenceDefault.c src/MQTTPacketOut.c src/WebSocket.c src/Clients.c src/OsWrapper.c src/MQTTPacket.c src/Base64.c src/Log.c src/Thread.c src/LinkedList.c src/MQTTReasonCodes.c src/MQTTPersistence.c src/utf-8.c src/SocketBuffer.c src/Tree.c src/Messages.c -L/home/t101/sysdir/ssl/lib -shared -Wl,-init,MQTTAsync_init -lpthread -Wl,-soname,libpaho-mqtt3a.so.1 src/SHA1.c: In function `SHA1_ProcessBlock': src/SHA1.c:112: warning: implicit declaration of function `__builtin_bswap32' src/WebSocket.c: In function `WebSocket_buildFrame': src/WebSocket.c:225: warning: implicit declaration of function `__builtin_bswap16' src/WebSocket.c:230: warning: integer constant is too large for "long" type src/WebSocket.c:230: warning: comparison is always true due to limited range of data type src/WebSocket.c:232: warning: implicit declaration of function `__builtin_bswap64' src/WebSocket.c: In function `WebSocket_calculateFrameHeaderSize': src/WebSocket.c:297: warning: integer constant is too large for "long" type src/WebSocket.c:297: warning: comparison is always true due to limited range of data type ln -s libpaho-mqtt3a.so.1.0 build/output/libpaho-mqtt3a.so.1 ln -s libpaho-mqtt3a.so.1 build/output/libpaho-mqtt3a.so arm-linux-gcc -g -fPIC -I/home/t101/sysdir/ssl/include/ -Os -Wall -Ibuild -o build/output/libpaho-mqtt3as.so.1.0 src/Heap.c src/Socket.c src/SSLSocket.c src/MQTTProtocolClient.c src/MQTTProtocolOut.c src/MQTTAsync.c src/SHA1.c src/StackTrace.c src/MQTTProperties.c src/MQTTPersistenceDefault.c src/MQTTPacketOut.c src/WebSocket.c src/Clients.c src/OsWrapper.c src/MQTTPacket.c src/Base64.c src/Log.c src/Thread.c src/LinkedList.c src/MQTTReasonCodes.c src/MQTTPersistence.c src/utf-8.c src/SocketBuffer.c src/Tree.c src/Messages.c -DOPENSSL -L/home/t101/sysdir/ssl/lib -shared -Wl,--start-group -lpthread -ldl -lssl -lcrypto -Wl,--end-group -Wl,-init,MQTTAsync_init -Wl,-soname,libpaho-mqtt3as.so.1 -Wl,-no-whole-archive src/SSLSocket.c: In function `SSLSocket_createContext': src/SSLSocket.c:537: warning: `TLSv1_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1866) src/SSLSocket.c:542: warning: `TLSv1_1_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1872) src/SSLSocket.c:547: warning: `TLSv1_2_client_method' is deprecated (declared at /home/t101/sysdir/ssl/include/openssl/ssl.h:1878) src/SSLSocket.c: In function `SSLSocket_initialize': src/SSLSocket.c:476: warning: statement with no effect src/WebSocket.c: In function `WebSocket_buildFrame': src/WebSocket.c:225: warning: implicit declaration of function `__builtin_bswap16' src/WebSocket.c:230: warning: integer constant is too large for "long" type src/WebSocket.c:230: warning: comparison is always true due to limited range of data type src/WebSocket.c:232: warning: implicit declaration of function `__builtin_bswap64' src/WebSocket.c: In function `WebSocket_calculateFrameHeaderSize': src/WebSocket.c:297: warning: integer constant is too large for "long" type src/WebSocket.c:297: warning: comparison is always true due to limited range of data type ln -s libpaho-mqtt3as.so.1.0 build/output/libpaho-mqtt3as.so.1 ln -s libpaho-mqtt3as.so.1 build/output/libpaho-mqtt3as.so arm-linux-gcc -L/home/t101/sysdir/ssl/lib -I src -lpthread -L build/output -o build/output/paho_c_version -lpaho-mqtt3a src/MQTTVersion.c -ldl build/output/libpaho-mqtt3a.so: undefined reference to `clock_gettime' build/output/libpaho-mqtt3a.so: undefined reference to `__builtin_bswap16' build/output/libpaho-mqtt3a.so: undefined reference to `__builtin_bswap32' build/output/libpaho-mqtt3a.so: undefined reference to `__builtin_bswap64' collect2: ld returned 1 exit status Makefile:274: recipe for target 'build/output/paho_c_version' failed make: *** [build/output/paho_c_version] Error 1
最新发布
06-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值