Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using Ubuntu 11.04. I have installed the compiler gcc 4.5 by using the command sudo apt-get install gcc 4.5 in terminal. Now I need the command to enable OpenMP. Is it gcc -fopenmp foo.c ?


@pl1nk I started from the beginning:

1st step=> sudo apt-get install build-essential

2nd step=> sudo apt-get install gcc 4.5

And now the output of gcc -v is:

**ubuntu@ubuntu:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)** 

In few words the same results....
What should I do now?
share|improve this question

1 Answer

Run update-alternatives --config gcc to be asked to choose the GCC version you want to use among those installed.

Then you could run gcc with the chosen version.

share|improve this answer
It looks like there is only one version – Anita 7 May 31 '12 at 22:42
ubuntu@ubuntu:~$ update-alternatives --config gcc update-alternatives: error: no alternatives for gcc. – Anita 7 May 31 '12 at 22:42
@Anita7 How did you install gcc 4.5? What´s the output of ggc -v – pl1nk May 31 '12 at 22:47
I have installed the compiler gcc 4.5 by using the command sudo apt-get install gcc 4.5 – Anita 7 Jun 1 '12 at 12:28
@Anita7 It seems that you have only gcc 4.5 installed. You can proceed with gcc -fopenmp foo.c as you mentioned. – pl1nk Jun 1 '12 at 12:45
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.