I have a mass of code that I’m trying to convert from g++ version 4.2.2 to 4.7.2. In version 4.2.2 and prior, it seems that uint was defined as unsigned int. I know this is not a standard c++ thing and that real men write ISO standard C++, but I was wondering if there was a flag or some sort of way to make g++ accept uint without modifying all the source files. Can I change CPPFLAGS or add a switch to the g++ runline? My googles yielded nothing. I have some source files coming from a different group at work and I’d like to accept their uint transgressions.
e.g.
#include <iostream>
#include <fstream>
#include <assert.h>
using namespace std;
int main(void) {
uint foo = 0xdeadbeef;
cout<<hex<<foo<<endl;
}
yields:
/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
You can add a
-include a_file_where_there_is_typedef_to_uint.hflag to g++From the manual