I installed the C++ compiler MinGW following this tutorial, but when i used the consol commands:
> gcc --version
g++ (GCC) 4.8.1
......
> g++ --version
g++ (GCC) 4.8.1
......
> gdb --version
GNU gdb (GDB) 7.6.1
i dont receive any information and the console prints 'gcc is not recognizable as internal or external command'
When you execute step 3:
Setup environment variable PATH to include "<MINGW_HOME>/bin" where <MINGW_HOME> is the MinGW installed directory that you have chosen in the previous step.
Be aware that changes made to your path in the control panel don't affect existing consoles.
You need to open up a new console for the path to affect it.
The other possibility is that you've modified the path in a console you were working in but this is the wrong way to do it, since that path will not affect future consoles.
You most likely missed this step:
Setup environment variable PATH to include "<MINGW_HOME>/bin" where <MINGW_HOME> is the MinGW installed directory that you have chosen in the previous step.
What is the output of this command?
echo $PATH
If it does not include "<MINGW_HOME>/bin", you need to make the necessary adjustment.
Besides, that tutorial is somewhat dated. Cygwin Ports does include packages for MinGW, plus precompiled libraries, available from Cygwin's setup.exe. The packages are:
mingw64-i686-gcc
mingw64-i686-gcc-g++
or
mingw64-x86-gcc
mingw64-x86-gcc-g++
depending on your architecture. If you use those packages, the compiler will be installed in /usr/bin (which already is in your PATH), and you can access it (e.g. as i686-w64-mingw32-gcc) right away.
I cannot compile anything with the current version of emscripten from the ubuntu repos
Here is the error
http://pastebin.com/j5Z0ztTs
I suspect it might be because emscripten is outdated in the repos, but why is there no bug reports??
Could anyone help? I cannot find any updated information.
Thanks in advance.
The reason is because you are using the /usr/bin/clang++ that comes with your Linux distribution.
This version does not support Javascript backend. In order to use emscripten, you have to compile fastcomp (an LLVM clang compiler with Javascript backend added)
If you have not built fastcomp yet, Emscripten won't work.
Check out this page for installation instructions:
http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
If you have already built fastcomp, then the problem is in your emscriptenrc file, and moreover your PATH.
This is how I worked around the issue:
I created a file called emscriptenrc.sh that did this:
export PATH=/home/mike/emscripten/fastcomp/build/master/bin:/home/mike/emscripten/fastcomp/build/master/include:/home/mike/emscripten/fastcomp/build/master/lib:$PATH
then after I created that file
I rebuilt the ~/.emscripten configuration file by calling
./emcc -v from the emscripten build directory -- this seemed to get the right version of clang registered...
now you can go ahead and compile with emcc
I would suggest reading http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html
as well as the rest of the documentation prior to trying to use emscripten.
I have installed Debian 7.0.0 and have just installed the full version of NetBeans 7.3 which is supposed to have C/C++ building capabilities. However, when I start, I get the message
No C/C++ Compilers Found
I did a search for this error message and Bugzilla said it was obsolete instructions. However, when I try to build a C++ application, it gives error highlights for standard C++ includes and gives a pop-up asking for the location of the C++ compiler and Makefile. I thought these were both provided by IDEs that are supposed to support C++.
All of my C/C++ compilers (or their names at least) are in
/usr/share/bash-completion/completions
However, when I try to execute them, they behave like they are not there
peter#app-server:~$ ls /usr/share/bash-completion/completions/g++
/usr/share/bash-completion/completions/g++
peter#app-server:~$ /usr/share/bash-completion/completions/g++
bash: /usr/share/bash-completion/completions/g++: Permission denied
peter#app-server:~$ sudo /usr/share/bash-completion/completions/g++
sudo: /usr/share/bash-completion/completions/g++: command not found
peter#app-server:~$
Check that you actually have a compiler installed. Typing g++ -v on the command line is the easiest way to verify that (and you also get to know which version you're using by default).
If you don't have a compiler yet, aptitude install build-essential will install the bare minimum.
I installed gcc 4.6. from macports (for support of C++0x). But when I check the 'gcc --version` it is showing older version. How to use the newer gcc installed by macports?
You can control the symlink in /opt/local/bin/gcc by using port select. You can see available version using port select --list gcc. Anything listed with mp- as prefix refers to MacPorts' own port, gcc42 and llvm-gcc42 refer to the compilers shipped with Xcode by Apple.
Example from my system:
$ port select --list gcc
Available versions for gcc:
gcc42
llvm-gcc42
mp-gcc45
none (active)
$ sudo port select --set gcc mp-gcc45
Password:
Selecting 'mp-gcc45' for 'gcc' succeeded. 'mp-gcc45' is now active.
After that, either open a new terminal window or issue hash -r to make bash recognize the change.
I remember it being something like g++-mp-4.6. I believe it's enough to set the environment variable CXX to that.
Just make sure macports' path comes first in your $PATH. Or use gcc-mp-4.6 or something like that.
So I am a new programmer and I just installed XCode on my Macbook to get the GCC. I think Xcode is the only way for getting GCC on OSX. Now when I run my Hello World application, in C++, g++ comes up saying it is version 4.0.1 but when I look for commands starting with g I also see g++-4.2. Is there any way of making 4.2 default rather than 4.0.1, and also is there a way to updating gcc to the latest version 4.4.0?
EDIT: Ok, so I installed macports and installed gcc4.4 and it shows up on terminal as gcc-mp-4.4 and how do I make it default with gcc_select, like what are the commands and stuff. Thanks.
If you install macports you can install gcc select, and then choose your gcc version.
/opt/local/bin/port install gcc_select
To see your versions use
port select --list gcc
To select a version use
sudo port select --set gcc gcc40
I know it is an old request. But it might still be useful to some. With current versions of MacPorts, you can choose the default gcc version using the port command.
To list the available versions of gcc, use:
$ sudo port select --list gcc
Available versions for gcc:
gcc42
llvm-gcc42
mp-gcc46
none (active)
To set gcc to the MacPorts version:
$ sudo port select --set gcc mp-gcc46
I'm just dropping in to say that using a soft link to accomplish this is a terrible, no-good, horrible idea.
One of the key things about writing software is reproduceability - you want to be able to get the same results every time. These systems are so complex that you want to reduce all invisible sources of error.
Having a soft link is an invisible source of error. It's the sort of thing you'll forget in a month, then move to a different machine, and wonder why you are getting different results - or, you'll try to upgrade your system, and you'll get weird errors because it's not expecting a softlink there.
Moreover, this isn't guaranteed to work - in particular, it's not clear that you will get the correct system include files, which have certainly changed between iterations of gcc.
gcc_select is a systematic way of doing the same thing which will work predictably, or in the very worst case you can file a bug report and get an eventual fix or fix it yourself.
Unfortunately :-( gcc_select does not affect which compiler XCode uses so it's not the way to go if you need to work in XCode (which I do). I still don't know what that way might be.
The following recipe using Homebrew worked for me to update to gcc/g++ 4.7:
$ brew tap SynthiNet/synthinet
$ brew install gcc47
Found it on a post here.
use "gcc_select -l"
>
gcc_select -l
gcc40 mp-gcc44
>
gcc_select mp-gcc44
You can have multiple versions of GCC on your box, to select the one you want to use call it with full path, e.g. instead of g++ use full path /usr/bin/g++ on command line (depends where your gcc lives).
For compiling projects it depends what system do you use, I'm not sure about Xcode (I'm happy with default atm) but when you use Makefiles you can set GXX=/usr/bin/g++ and so on.
EDIT
There's now a xcrun script that can be queried to select appropriate version of build tools on mac. Apart from man xcrun I've googled this explanation about xcode and command line tools which pretty much summarizes how to use it.
in /usr/bin type
sudo ln -s -f g++-4.2 g++
sudo ln -s -f gcc-4.2 gcc
That should do it.
You can install your GCC manually
either through
sudo port install gcc46
or your download the source code from one of the mirrors from here for example here
tar xzvf gcc-4.6.0.tar.gz
cd gcc-4.6.0
./configure
make
well if you have multiple version, then through you can choose one
port select --list gcc
remember port on mac is called macport https://www.macports.org/install.php and add add the bin into your path export PATH=$PATH:/opt/local/bin
Whatever Apple ships as the default gcc in xcode (4.2.1 on 10.6, 4.0.1 before) is well tested (and maintained) by the apple guys and the "standard" to build software with on OS X. Everything else is not, so think twice if you want to develop software, or be gcc/OS X beta tester.