LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-22-2010, 11:16 PM   #1
snc
LQ Newbie
 
Registered: Jan 2010
Posts: 5

Rep: Reputation: 0
Unhappy Why couldn't the gcc(version4.3.3) be used to compile the gcc(version3.3.2)?


Hi,everybody
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?
 
Old 01-22-2010, 11:36 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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.

and

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.

Last edited by GrapefruiTgirl; 01-22-2010 at 11:37 PM.
 
Old 01-23-2010, 03:45 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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 :
4.3
http://gcc.gnu.org/gcc-4.3/porting_to.html
.....
 
Old 01-23-2010, 10:22 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
@ 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?
 
Old 01-23-2010, 11:03 AM   #5
the trooper
Senior Member
 
Registered: Jun 2006
Location: England
Distribution: Debian Bullseye
Posts: 1,508

Rep: Reputation: Disabled
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:

Code:
export CC=/usr/bin/gcc-4.1
This will make gcc-4.1 the default compiler until you end the shell session.After you terminate the shell you will be using the default GCC.
 
Old 01-24-2010, 04:15 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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
http://packages.ubuntu.com/hardy-updates/gcc-3.3
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.
.....

P.S. :
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>
.....

Last edited by knudfl; 01-24-2010 at 05:36 AM.
 
Old 01-24-2010, 11:26 AM   #7
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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)

Sasha
 
  


Reply

Tags
compile error, gcc



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error, 'H5G_obj_t' does not name a type, is gcc 4.3 incompatible with gcc 3 ? samrat_rao Linux - Software 5 03-03-2009 02:28 PM
Initial gcc installation-How to compile gcc itself pgb205 Linux - Software 4 02-26-2008 10:24 PM
Compile GCC 2.9 using GCC 3.x kassle Linux - Software 3 11-27-2006 09:37 PM
gcc 3.4.1 want not to compile, but 3.2.2 does BorisB Linux - Software 3 07-27-2004 06:53 PM
How to compile GCC if you don't have GCC? khermans Linux - Software 13 05-12-2004 06:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration