Advertisement

How to install gcc-3.2 (debian)

Started by September 27, 2002 07:13 AM
6 comments, last by stefu 22 years, 1 month ago
Hi. How can I use gcc-3.2? It''s installed (Debian package) but when I run gcc -v it says: Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease) If I try to compile simple test: gcc-3.2 test.cpp -o test it outputs: gcc-3.2: installation problem, cannot exec `cc1plus'': No such file or directory ----------- RacingTreme - for fun multiplayer racing: http://users.utu.fi/stkibr
Install the C++ compiler (apt-get install g++-3.2).

Also, you shouldn''t use the C compiler with C++ code. While GCC will likely invoke its C++ front-end if it recognizes a C++ file, it might invoke the linker differently. You''ll be safer with g++ when coding in C++.

Ah and ''test'' is the name of a standard tool. Don''t ''make install'' your program, and don''t be surprised if it behaves weirdly .

Hope this helps.
Advertisement
obviously he isn''t gonna install it, he doesn''t even have a makefile. and it''s just a test.

and g++ (at least on all my systems) is a symlink to gcc.
quote: Original post by C-Junkie
and g++ (at least on all my systems) is a symlink to gcc.

On my Debian system it isn't:
nav@seeker:/usr/bin$ ls -l g++lrwxrwxrwx    1 root     root            8 Sep  7 23:46 g++ -> g++-2.95nav@seeker:/usr/bin$ ls -l g++-2.95 -rwxr-xr-x    1 root     root        74088 Sep 23 16:24 g++-2.95nav@seeker:/usr/bin$ file g++-2.95g++-2.95: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),for GNU/Linux 2.2.0, dynamically linked (uses shared libs),stripped 


EDIT: shortened line length



[edited by - Null and Void on September 28, 2002 1:14:26 AM]
quote: Original post by C-Junkie
obviously he isn''t gonna install it, he doesn''t even have a makefile. and it''s just a test.


cp test /usr/local/bin. Trouble.Some distros also include "." in the path. You can see how this will lead to problems. It was simply a friendly advice to eventually save him some time.


quote:
and g++ (at least on all my systems) is a symlink to gcc.


There''s not standard requiring that. It''s not on any of my systems (Debian GNU/Linux, OpenBSD, NetBSD, FreeBSD). The linker will shoke if invoked by the C front-end:


  #include <iostream>int main( ) {  std::cout << "test" << std::endl;}gcc -o foo foo.cc/tmp/ccvV7Jjr.o: In function `main'':/tmp/ccvV7Jjr.o(.text+0xa): undefined reference to `endl(ostream &)''/tmp/ccvV7Jjr.o(.text+0x17): undefined reference to `cout''/tmp/ccvV7Jjr.o(.text+0x1c): undefined reference to `ostream::operator<<(char const *)''/tmp/ccvV7Jjr.o(.text+0x27): undefined reference to `ostream::operator<<(ostream &(*)(ostream &))''collect2: ld returned 1 exit status  


It works with the C++ front-end though, because the linker is invoked correctly. In order to build that code with ''gcc'', you''ll have to manually add a -lstdc++. You might also have to pass all the C++ include pathes to the C preprocessor, etc. Morality: it makes sense to use the C++ front-end to build C++ code .

Hope this helps.
Ah, I only have g++-2.95.4. But gcc is version gcc-3.2.1. g++-3.2 doesn''t even exist in apt packages in my dselect.

-----------
RacingTreme - for fun multiplayer racing:
http://users.utu.fi/stkibr
Advertisement
quote: Original post by stefu
Ah, I only have g++-2.95.4. But gcc is version gcc-3.2.1. g++-3.2 doesn''t even exist in apt packages in my dselect.

It should. I''m using Debian unstable and I have all of GCC 3.2 installed right now.

quote: Original post by Null and Void
It should. I''m using Debian unstable and I have all of GCC 3.2 installed right now.


Very funny, now they are there
Btw. can I remove older g++ and gcc now?

-----------
RacingTreme - for fun multiplayer racing:
http://users.utu.fi/stkibr

This topic is closed to new replies.

Advertisement