Results 1 to 2 of 2
I have some source code that was compiling well with gcc 4.1, recently I moved to openSuse that has gcc 4.3.1 and the same code fails to compile using this ...
- 07-04-2008 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 6
gcc 4.1 vs 4.3 source code compatibility
I have some source code that was compiling well with gcc 4.1, recently I moved to openSuse that has gcc 4.3.1 and the same code fails to compile using this version of compiler.
Generally it complains that it doesn't know functions like malloc or wtol. I can easily fix this by including appropriate headers like stdlib.h or what ever is necessary.
But it is important not to change the source code at all. Is it possible to make them compile using 4.3.1? Is there some flag that I can specify to the compiler?
Or do I need to uninstall 4.3.1 and install 4.1?
Thanks.
- 07-04-2008 #2
If the source code is the only thing you don't need to change, here's a kluge for you.
First, make a file whose only purpose is to include what needs to be included. I'm going to call it fred.h. The file might consist of this and only this, for example:
Then, before compiling each module, make a temporary file which is a concatenation of fred.h and the original source file. So instead of this:Code:#include stdlib.h
you might do this:Code:gcc barney.c -o barney
or instead of this:Code:cat fred.h barney.c > barney.tmp.c gcc barney.tmp.c -o barney
do this:Code:gcc barney.c betty.c wilma.c -o barney
Might this help?Code:cat fred.h barney.c > barney.tmp.c cat fred.h betty.c > betty.tmp.c cat fred.h wilma.c > wilma.tmp.c gcc barney.tmp.c betty.tmp.c wilma.tmp.c -o barney
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote