关于gcc g++编译 警告的问题 (欢迎讨论)
时间:2010-08-24
来源:互联网
- kenthy:~ # cat test.c
- #include <stdio.h>
-
- int main()
- {
- int i;
-
- if(i==0);{
- printf("%s\n", "asdas");
- }
- return 0;
- }
- kenthy:~ # cat test.cpp
- #include <iostream>
-
- using namespace std;
- int main()
- {
- int i;
-
- if(i==0);{
- cout << "asdas" << endl;
- }
- return 0;
- }
kenthy:~ # gcc -Wall -W -o test1 test.c
test.c: In function 鈥榤ain鈥?
test.c:7: warning: empty body in an if-statement
kenthy:~ # g++ -Wall -o test1 test.cpp
kenthy:~ # g++ -Wall -W -o test1 test.cpp
kenthy:~ # gcc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=i586-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
kenthy:~ # g++ -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=i586-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
不知道大家编译的都用什么选项,以前一般都只-Wall的, gcc g++处理警告的方式还不一样?
作者: ubuntuer 发布时间: 2010-08-24
而g++怎么都不能发现问题
作者: ubuntuer 发布时间: 2010-08-24
作者: prolj 发布时间: 2010-08-24
作者: daybreakcx 发布时间: 2010-08-24
作者: ecjtubaowp 发布时间: 2010-08-24
作者: hellioncu 发布时间: 2010-08-24
作者: davelv 发布时间: 2010-08-24
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28