Is it possible to re-enable the type `uint` in g ++ 4.7+?

I have a ton of code that I'm trying to convert from g ++ version 4.2.2 to 4.7.2. In version 4.2.2 and earlier, it seems that uint

is defined as unsigned int

. I know this is not a standard C ++ thing, and that real men write the ISO C ++ standard, but I was wondering if there is a flag or some way to make g ++ accept uint

without changing all source files. Can I change CPPFLAGS

or add a switch in runline g ++? My googles gave nothing. I have some source files coming from another group at work and I would like to accept violations uint

.

eg.

#include <iostream>
#include <fstream>
#include <assert.h>
using namespace std;
int main(void) {
    uint foo = 0xdeadbeef;
    cout<<hex<<foo<<endl;
}

      

gives:

/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

      

+3


source to share


1 answer


You can add a flag -include a_file_where_there_is_typedef_to_uint.h

to g ++

From the manual



-include file

Treat the file as if #include "file" appeared as the first line of the main source file. However, the first directory that looks for the file is the preprocessor working directory instead of the directory containing the main source file. If not found, the search is performed in the rest of the #include "..." search sequence as usual.

If multiple include options are specified, the files are included in the order they appear on the command line.

+9


source







All Articles