Choose compiler version


 
Thread Tools Search this Thread
Top Forums Programming Choose compiler version
# 1  
Old 12-07-2012
Choose compiler version

Hi,
I'm new, here, and I'm searching for a simple solution for a simple problem.

I'm working on RedHat 4.4.6-4 through a CentOS Virtual Machine and due to some reasons I must compile my C++ codes with these two different g++ versions: 4.4.6 and 4.2.2.

The fact is that I should be able to use a particular compiler of the two, depending on what I have to do. There's a way to select each time the proper g++ version within the compiling command by the UNIX bash shell? Are there some additional string for this purpose?

Thank's!
# 2  
Old 12-07-2012
How are you compiling? make ? If you don't override the variables in the makefile itself, you can do:

Code:
CC="/usr/bin/gcc-4.1.2" CXX="/usr/bin/g++-4.1.2" make

If they're things that generate makefiles from ./configure, you have to do
Code:
CC="/usr/bin/gcc-4.1.2" CXX="/usr/bin/g++-4.1.2" ./configure

This User Gave Thanks to Corona688 For This Post:
# 3  
Old 12-07-2012
The first problem is installation of the two versions. That means there are 2 versions of executables available - usually in /usr/bin. (Like corona shows). Plus, the necessary library versions must exist in /usr/lib.

The simple solutuion to the problem is to create 2 development boxes; you can create virtual RH installs sitting on top of an x86 box with virtual box software (free), for instance. Install the compiler you need, compile & link the code statically (statically only if the librarties do not exist on production boxes), and then push it to production.

However based on your question wording it sounds like you need some sysadmin help, first. Find out what you have installed.
This User Gave Thanks to jim mcnamara For This Post:
# 4  
Old 12-07-2012
Maybe yes, I need more informations from the admin... Unfortunately the presence of two versions doesn't depend on me.
Concerning the question of corona: no, I don't use make because I don't work with a so big code. I'm just implementing some little programs in a physics simulator that needs only a particular compiler version to make its source files...
# 5  
Old 12-07-2012
Try calling /usr/bin/gcc-4.2.2 instead of gcc.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Checking xlc compiler version

Hi, Below is output of lslpp command. bash-3.00# lslpp -L | grep xlC xlC.aix50.rte 11.1.0.1 C F XL C/C++ Runtime for AIX 5.3 xlC.cpp 9.0.0.0 C F C for AIX Preprocessor xlC.msg.en_US.cpp 9.0.0.0 C F C for AIX... (2 Replies)
Discussion started by: manoj.solaris
2 Replies

2. Programming

Incompatiblity of the code due to CC compiler version mismatch.

Incompatiblity of the code due to CC compiler version mismatch. I have a machine with Machine A-- Operating System:SunOs 5.8 Generic_117350-45 sun4u sparc SUNW,Ultra-80(solaris 5.8) CC Compiler:CC: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07 we have compiled C++... (36 Replies)
Discussion started by: Revathi R
36 Replies

3. Web Development

Which version of tomcat should i choose?

hello every body, i want to install tomcat but i want the latest stable version. I found the 7 version is latest but i found alot of minor versions from 7.0.6 to 7.0.32 and i don't know which one should i install. i have oracle 11 and want tomcat to communicate with it i will install tomcat... (4 Replies)
Discussion started by: maxim42
4 Replies

4. AIX

install two different compiler version

Hi all. I have a simple question. There's a way to install under AIX system (5.3) two different compiler version, i.e. ibm xlf fortran 11 and 12? Seems that smitty doesn't allows user to change the default installation path; it only allows you to save the replaced files of the superseded... (1 Reply)
Discussion started by: poldo000
1 Replies

5. AIX

how to find out the compiler version and OS from binary file

Command to get the Compiler version(xlc/gcc) from the binary on AIX platform. I m searching for the Command, to get the Compiler(xlc/gcc) used to build the binary on AIX. I got two commands used on Linux Platform: - readelf -a <lib> | grep comment - hexdump -C -s 0x49e7b -n 1812 <lib> ... (1 Reply)
Discussion started by: Prajakta
1 Replies

6. HP-UX

how can I install aC++ Compiler bundle Evaluation version

according those steps 1. Copy your 26 digit hexadecimal license key in a plain text (ASCII) file. 2. Save the file as aCC.cwd in the following location: /opt/aCC/newconfig/aCC.cwd 3. export the variable ST_CODEWORD to point to the file where the license key is stored. ... (0 Replies)
Discussion started by: alert0919
0 Replies

7. Programming

How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?

To make a programming language you need a compiler, so what was the first programming language and how was is created if you need the compiler first? The compiler itself is considered as a high language comparing to the machine! since the compiler is not created in 1's and 0's... Eventhough i... (12 Replies)
Discussion started by: f.ben.isaac
12 Replies

8. UNIX for Dummies Questions & Answers

What version is the compiler?

Hi ! we have a intel fortran compiler on our computer. How do i find out what version it is ? Thank you, dsmv. (1 Reply)
Discussion started by: dsmv
1 Replies

9. UNIX for Dummies Questions & Answers

gcc compiler version?

How do you determine which version of the GNU gcc compiler is on your system? (1 Reply)
Discussion started by: Ben070371
1 Replies
Login or Register to Ask a Question