我有大量的代码,我试图从g ++版本4.2.2转换为4.7.2.在4.2.2及更早版本中,它似乎uint被定义为unsigned int.我知道这不是一个标准的c ++事物而且真正的男人会编写ISO标准C++,但我想知道是否有一个标志或某种方式使g ++接受uint而不修改所有源文件.我可以更改CPPFLAGS或添加到g ++运行线的开关吗?我的谷歌一无所获.我有一些源文件来自不同的工作组,我想接受他们的uint违规行为.
例如
#include <iostream>
#include <fstream>
#include <assert.h>
using namespace std;
int main(void) {
uint foo = 0xdeadbeef;
cout<<hex<<foo<<endl;
}
Run Code Online (Sandbox Code Playgroud)
收益率:
/tmp/rbroger1/gcc_update rbroger1 @ plxc25804
% /usr/intel/pkgs/gcc/4.2.2/bin/g++ ~/tmp.cc && ./a.out
deadbeef
/tmp/rbroger1/gcc_update rbroger1 @ plxc25804
% /usr/intel/pkgs/gcc/4.7.2/bin/g++ ~/tmp.cc && ./a.out
/nfs/pdx/home/rbroger1/tmp.cc: In function 'int main()':
/nfs/pdx/home/rbroger1/tmp.cc:8:5: error: 'uint' was not declared in this scope
/nfs/pdx/home/rbroger1/tmp.cc:8:10: error: expected ';' before 'foo'
/nfs/pdx/home/rbroger1/tmp.cc:9:16: error: 'foo' was not declared in this scope
Run Code Online (Sandbox Code Playgroud)