I have a problem with GCC. I want to update it to a new version, from the 4.2.1, to program with parallel programming. However, in this version there is no library . How can I download an updated version?
我对GCC有问题。我想把它更新到一个新的版本,从4.2.1到并行编程的程序。但是,在这个版本中没有库。如何下载更新版本?
The error that the terminal give me is:
终端给我的错误是:
omp_hello.c:11:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
4 个解决方案
#1
12
-
download gcc-4.9-bin.tar.gz download or newer from http://hpc.sourceforge.net/: http://prdownloads.sourceforge.net/hpc/gcc-4.9-bin.tar.gz
下载gcc - 4.9 bin.tar。gz从http://hpc.sourceforge.net/: http://prdownloads.sourceforge.net/hpc/gcc-49-bin.tar.gz下载或更新。
-
cd to your downloads folder and un-gzip the archive
gunzip gcc-4.9-bin.tar.gz
(Google Chrome would do that automatically)cd到你的下载文件夹,然后取消压缩文件gcc-4.9-bin.tar。gz(谷歌Chrome会自动完成)
-
in the same folder run
sudo tar -xvf gcc-4.9-bin.tar -C /
- this will place new executable to /usr/local/bin在同一个文件夹中运行sudo tar -xvf gcc-4.9-bin。tar - c / -这将把新的可执行文件放置到/usr/local/bin。
-
add the following to ~/.bash_profile:
export PATH=/usr/local/bin:$PATH
添加以下内容到~/。bash_profile:出口路径= / usr /地方/ bin:美元的道路
-
open new terminal and run
which gcc
. This should point to/usr/local/bin/gcc
打开新的终端并运行gcc。这应该指向/usr/local/bin/gcc。
#2
5
I got this message when I tried to reinstall GCC via Homebrew.
当我试图通过自制程序重新安装GCC时,我得到了这个消息。
GCC has been built with multilib support. Notably, OpenMP may not work: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
GCC是由多库支持构建的。值得注意的是,OpenMP可能不起作用:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670。
If you need OpenMP support you may want to brew reinstall gcc --without-multilib
如果您需要OpenMP支持,您可能想要重新安装gcc——不使用multilib。
So, if you have Homebrew installed, you could try (on the terminal):
所以,如果你安装了Homebrew,你可以试试(在终端上):
brew reinstall gcc --without-multilib
This process may take a while !
这个过程可能需要一段时间!
#3
2
According to this thread on apple's forums, try using gcc-4.9-bin.tar .
根据苹果论坛上的帖子,尝试使用gcc-4.9-bin。焦油。
First install the gcc-4.9 and type "xcode-select --install"
on your terminal.
首先在终端安装gcc-4.9和type“xcode-select -install”。
Then, use "/usr/local/bin/gcc "
as compiler.
然后,使用“/usr/local/bin/gcc”作为编译器。
#4
1
I solve it just adding aliases to .bash_profile
我只需要将别名添加到。bash_profile。
# Aliases in order to use brew gcc
alias gcc='gcc-5'
alias cc='gcc-5'
alias g++='g++-5'
alias c++='c++-5'
#1
12
-
download gcc-4.9-bin.tar.gz download or newer from http://hpc.sourceforge.net/: http://prdownloads.sourceforge.net/hpc/gcc-4.9-bin.tar.gz
下载gcc - 4.9 bin.tar。gz从http://hpc.sourceforge.net/: http://prdownloads.sourceforge.net/hpc/gcc-49-bin.tar.gz下载或更新。
-
cd to your downloads folder and un-gzip the archive
gunzip gcc-4.9-bin.tar.gz
(Google Chrome would do that automatically)cd到你的下载文件夹,然后取消压缩文件gcc-4.9-bin.tar。gz(谷歌Chrome会自动完成)
-
in the same folder run
sudo tar -xvf gcc-4.9-bin.tar -C /
- this will place new executable to /usr/local/bin在同一个文件夹中运行sudo tar -xvf gcc-4.9-bin。tar - c / -这将把新的可执行文件放置到/usr/local/bin。
-
add the following to ~/.bash_profile:
export PATH=/usr/local/bin:$PATH
添加以下内容到~/。bash_profile:出口路径= / usr /地方/ bin:美元的道路
-
open new terminal and run
which gcc
. This should point to/usr/local/bin/gcc
打开新的终端并运行gcc。这应该指向/usr/local/bin/gcc。
#2
5
I got this message when I tried to reinstall GCC via Homebrew.
当我试图通过自制程序重新安装GCC时,我得到了这个消息。
GCC has been built with multilib support. Notably, OpenMP may not work: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
GCC是由多库支持构建的。值得注意的是,OpenMP可能不起作用:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670。
If you need OpenMP support you may want to brew reinstall gcc --without-multilib
如果您需要OpenMP支持,您可能想要重新安装gcc——不使用multilib。
So, if you have Homebrew installed, you could try (on the terminal):
所以,如果你安装了Homebrew,你可以试试(在终端上):
brew reinstall gcc --without-multilib
This process may take a while !
这个过程可能需要一段时间!
#3
2
According to this thread on apple's forums, try using gcc-4.9-bin.tar .
根据苹果论坛上的帖子,尝试使用gcc-4.9-bin。焦油。
First install the gcc-4.9 and type "xcode-select --install"
on your terminal.
首先在终端安装gcc-4.9和type“xcode-select -install”。
Then, use "/usr/local/bin/gcc "
as compiler.
然后,使用“/usr/local/bin/gcc”作为编译器。
#4
1
I solve it just adding aliases to .bash_profile
我只需要将别名添加到。bash_profile。
# Aliases in order to use brew gcc
alias gcc='gcc-5'
alias cc='gcc-5'
alias g++='g++-5'
alias c++='c++-5'