Why couldn't the gcc(version4.3.3) be used to compile the gcc(version3.3.2)?
I got some sourcecode written with c++. I found it did not supported by the newer version of gcc. So I wanted to install an older version. But it always comes up with the question like "./read-rtl.c:653: error: lvalue required as increment operand
", what should I do now?
I'm certainly no expert on this subject, but, cannot the gcc be given flags to tell it to emulate an older version of itself, or to adhere to an older coding standard than it is actually capable of?
As for your actual question, it seems you sort of have two questions combined:
1) How to install an older version of gcc, perhaps (most likely) along WITH your current gcc.
2) When trying to compile, you're getting that error: ./read-rtl.c:653: error: lvalue required as increment operand and want to know what to do about it?
As to question one, my feeling is that installing a second gcc into Ubuntu, is going to be a harder than repairing the broken C++ code (provided the entire code isn't totally borked) :) but maybe someone can tell you differently. Sure, it's possible, but I suspect the package manager won't like to do that job, and you will be installing the second gcc manually.
As for the error message, you'll have to await someone much more experienced with C/C++ than I am, to try to help you figure out what that means, and what you can maybe do to fix it.
Welcome to LQ.
Having e.g. four different compilers in Ubuntu
at the same time is no problem. But the selection
is limited on the later releases.
The gcc-3.3 / g++-3.3 from Ubuntu 8.04 Hardy will
work on later Ubuntu's.
Porting old code to be used with a newer compiler :
@ knudfl -- can you give us an idea how to most easily install multiple GCC's in Ubuntu? In my limited experience with that distro, I am under the impression that the package manager will prefer to "upgrade" or "downgrade" the installed GCC, with another version. So, would one need to manually install other versions alongside the main one?
I have several versions of GCC on my Debian system.
For example,if i wanted to use gcc-4.1 temporarily you can use the the export command:
The "gcc" selection can be viewed in the Package Manager
= Synaptic, using one of the two "Search" windows.
Or by the command : apt-cache search gcc
Result Ubuntu 9.10 Karmic :
gcc-4.1, gcc-4.2, gcc-4.3, gcc-4.4
Ref. post # 4 : @ GrapefruiTgirl :
Installing : 1)
sudo apt-get install g++-4.1 g++-4.2 g++-4.3
2) Getting version 3.3 and / or 3.4 : use the "6" .deb
packages from e.g. Hardy
gcc-3.3, cpp-3.3, gcc-3.3-base. g++-3.3, libstdc++5
libstdc++5-3.3-dev .. install with :
sudo dpkg -i *.deb
ls /usr/bin/gcc* : gcc , gcc-3.3 , gcc-4.3 , gcc-4.4
ls /usr/bin/g++* : g++ , g++-3.3 , g++-4.3 , g++-4.4
All extras, here 3.3 and 4.3 have unique filenames,
so you can do "export" (see post # 5) or , example :
make CC=gcc-3.3 CXX=g++-3.3
Debian - Ubuntu, Redhat - Fedora - CentOS, Mandriva -
PCLinuxOS, Suse , Slackware :
all have extra "compat" compilers,
.. to be installed at the same time.
You can even use multible compilers for the same program :
Different settings in the 'Makefile.in's in the different
sections of the software :
CC = gcc<version>
CPP = g++<version>
RE: "sudo apt-get install g++-4.1 g++-4.2 g++-4.3"
Wow, I'm impressed with how easy that is! I had no idea, thanks :) I assumed they would each like to install to the same location when installing them by apt-get. (Another fine example of why to not assume anything)
|All times are GMT -5. The time now is 08:21 PM.|