Any option in C++ to set default variable type to int
-
23-06-2021 - |
Question
Is there any option to omit variable type or to set variable type to int
in c++ code that to be compiled with g++ compiler in linux.
const bufLen = 2000;
Compilation went fine in solaris (as I am doing porting from solaris to linux).
One more thing ,I dont have control over the file as it is generated by some parser (provided by some third party in the form of binary)
Since I cant change the c++ file(as it is generated everytime before compilation) , I need some option (of g++) so I can include during compilation to suppress/resolve the error:
error: ISO C++ forbids declaration of `bufLen` with no type
EDIT :
INFO : options currently I am using -c -fPIC -Wno-deprecated -m32 -O2 -ffriend-injection -g
Is anyone of the options causing me trouble (or affecting other) ?
Thanks in advance
Solution
Thanks to AndersK who gave me a solution (through comments [below my question])
I tried compiling using -fms-extensions
with g++ which resolved my problem
Reference : http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/C-Dialect-Options.html
PS : For visibility sake , I added the answer in answer section . Credits go to person who actually answered :)
OTHER TIPS
Try -ansi
or -std=c89
. http://gcc.gnu.org/onlinedocs/gcc-4.0.2/gcc/C-Dialect-Options.html