Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any option in C++ to set default variable type to int

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

like image 659
Makesh Avatar asked Oct 22 '22 15:10

Makesh


1 Answers

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 :)

like image 90
Makesh Avatar answered Oct 29 '22 21:10

Makesh