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.h
flag to g++
From the manual
-include file
Process file as if #include "file" appeared as the first line of the primary source file. However, the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file. If not found there, it is searched for in the remainder of the #include "..." search chain as normal.
If multiple -include options are given, the files are included in the order they appear on the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With