Questions tagged [g++]
G++ is the C++ front-end of the Gnu Compiler Collection (GCC)
322
questions
299
votes
10
answers
725k
views
How to choose the default gcc and g++ version?
So I have installed gcc-4.4 and gcc-4.3 (same for g++). Now as far as I remember there is a tool in Ubuntu which sets the symlinks for you if you just tell it which version you want. However it does ...
80
votes
7
answers
283k
views
Getting + installing gcc/g++ 4.9 on Ubuntu? [duplicate]
How do I install the latest version of gcc and g++?
I am using a variety of C++11 and C++1y features; which is why I need this.
59
votes
1
answer
72k
views
How to install g++ 10 on Ubuntu 18.04?
I would like to explore concepts and other new features in C++20, provided by g++ 10. However, I cannot seem to find any resources that allows me to apt-get a g++ 10 online?
What is the easiest way ...
56
votes
3
answers
174k
views
How to install the latest g++(currently 5.1) in Ubuntu(currently 14.04)? [duplicate]
This question always bothers me! Last time for 4.9 I tried the commands mentioned in this answer for g++4.9. The same trick doesn't work now:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo ...
30
votes
2
answers
54k
views
What exactly does gcc-multilib mean on Ubuntu?
After hanging long time with older Ubuntu (v.12) I'm updating to v.16 and am very confused with mentions of "gcc-multilib".
Is this actually Apple's "fat binaries" or "universal binaries" model ...
27
votes
1
answer
267k
views
How to install g++ compiler?
I have tried the following:
sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest ...
25
votes
3
answers
26k
views
Where can I find a g++ 4.7 package?
Some time ago, I managed to find PPA featuring g++-4.7 build. However, I had to reinstall everything on my machine and I lost name of that PPA. Could anyone point me to it? I tried to find it again, ...
16
votes
3
answers
120k
views
fatal error :"python.h" no file or directory?
While looking for a solution for the Hungarian problem, I found this GitHub link.
I went through the readme.md file and I performed everything described there. After copying hungarian.so into my ...
16
votes
2
answers
235k
views
How to install g++ in Ubuntu 14.04? [duplicate]
I have recently installed ubuntu 14.04 in virtual box. Now I want to install g++ 4.7 in it. I am trying this command in terminal but its not working.
sudo apt-get install g++-4.7
Reading package ...
15
votes
3
answers
25k
views
Downloaded g++ 4.8 from the PPA but can't set it as default?
I have downloaded g++ 4.8 on Ubuntu 12.10 by doing:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.8
but when I do:
sudo update-alternatives --...
14
votes
2
answers
68k
views
Updating to latest gcc and g++ on Ubuntu 16.04
I recently tried to downgrade to gcc 4.7 since a cfd code I was working on didn't compile with the latest gcc version. But after many errors and the code still not compiling I gave up and would like ...
12
votes
2
answers
8k
views
Disabling C++11 in GCC 7.3
It seems like in Ubuntu 18.04, the default shipped g++ (version 7.3.0) runs in C++11 compatible mode by default. I am getting some errors in my old codes which are not C++11 compatible. I installed g++...
10
votes
2
answers
29k
views
G++ compilation error "cc1plus" not found
I think I accidentally deleted a couple files from my machine, and now G++ won't compile.
I tried to apt-get remove it then apt-get install it to see if it would fix it, but it didn't work. Now I have ...
9
votes
2
answers
20k
views
Install g++ ubuntu 14.04 Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
I just typed:
sudo apt-get install g++
and got:
The following packages have unmet dependencies:
g++ : Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
E: Unable to correct ...
9
votes
2
answers
14k
views
How to install a specific version of g++?
In my Ubuntu there is g++ --version -
g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
...
8
votes
2
answers
65k
views
How can I know that I have g++ installed in my ubuntu? [duplicate]
I have recently installed ubuntu 14.04 . I tried to run a c++ code by a command like this:
g++ first.cpp -o first
Then it said:
The program 'g++' is currently not installed. You can install it by ...
8
votes
2
answers
27k
views
asm/errno.h: No such file or directory
I'm trying to install gcc 4.8.1 at the moment. Currently 4.8.2 and 4.9.1 are installed. I downloaded an 4.8.1 from here http://gcc.cybermirror.org/releases/gcc-4.8.1/ . After extracting the files I ...
8
votes
1
answer
19k
views
14.04.01 32-bit: Missing g++ 64-bit include files when cross-compiling
So, I've got 32-bit Xubuntu 14.04.1 installed. We have some interface code where we intend to release SOs for the various platforms we support, and Windows DLLs. (Yes I know, binary release bad, but ...
7
votes
2
answers
14k
views
Ubuntu 13.04 with gcc/g++/gfortran 4.8 by default?
I plan to download and install Ubuntu 13.04 and I would like to have two compilers on my system.
First question: what is the version of gcc/g++/gfortran shipped with ubuntu 13.04 ? (is it 4.7.3 ?).
...
7
votes
1
answer
25k
views
Cannot install g++ because packages g++, libqt4-opengl, and libqt4-svg have unmet dependencies
While trying to compile a program with the following command:
g++ -o <output_file> <my_file.cpp>
I found the following report....
The program 'g++' can be found in the following packages:
...
6
votes
3
answers
8k
views
QtCreator not recognizing linked libraries after upgrading Ubuntu to 20.04
I've upgraded from Ubuntu 18.04 to 20.04 and besides some nasty grub issues most things worked out of the box. But my QtCreator (Qt Creator 4.11.0, Based on Qt 5.12.8 (GCC 9.3.0, 64 bit)) is facing ...
6
votes
3
answers
20k
views
How to install clang-14 on Ubuntu 18.04?
Can you help me install clang-14 on Ubuntu 18.04? I think I need a valid repo as apt-get install clang-14 does not work.
$ cat /etc/issue
Ubuntu 18.04 LTS \n \l
$ sudo apt-get update
Hit:1 http://...
6
votes
4
answers
13k
views
Simple C++ Thread Program Can't Be Compiled
The following is my 1st multi-threaded program. But while it was compiled, there is a linking error. The part of the error message:
std::thread::thread<void (&)(int), int&>(void (&...
6
votes
4
answers
2k
views
How to build Asterisk 1.8 on Xenial?
Asterisk 13.1.0 is available in the repos for Xenial.
But I'm supporting an application that needs Asterisk 1.8 LTS, because we use a custom plugin. We need to keep using Asterisk 1.8 and building ...
6
votes
4
answers
26k
views
" g++ not installed " even after installing it " sudo apt-get install g++ "
i recently installed Ubuntu on a VMware and following a tutorial...
gcc works for me, but when i try g++, it says " The program 'g++' is currently not installed. You can install it by typing: sudo ...
6
votes
3
answers
3k
views
How do I compile/run C++ code in the console?
I'm trying to run my C++ code using the console. I used the header file conio.h like I did when I used Turbo C++ IDE in Windows, and I ran the code in console using
g++ filename.cpp
I have installed ...
6
votes
3
answers
6k
views
How to see object code generated by g++?
g++ -c xyz.cpp
creates an object file xyz.o
But when I open it in vim editor it shows some crazy text...
How can I see the machine code?
What package can use to open and see that machine code?
6
votes
1
answer
29k
views
How to use C++ 11 features in the latest version of g++ [duplicate]
Newbie here.
I just got an error running from the terminal a C++ program I wrote: error: ‘stoi’ is not a member of ‘std’. They told me the compiler is too old.
I'm using Ubuntu 14.04.
My g++ version ...
6
votes
1
answer
7k
views
What package provides -llua for g++?
I've installed all lua5.1 development packages from Synaptic and the g++ linker can not find -llua. I've read on some other question that it is possible that -llua has some other name and that I ...
6
votes
1
answer
12k
views
How to install g++ 4.8?
I have G++ 4.7.2 on my Ubuntu 12.04 and I'm trying to install 4.8.
I downloaded the file from the GNU repository.
After configure and make, I get the following error:
collect2: error: ld returned 1 ...
6
votes
2
answers
6k
views
Getting the most recent releases of gcc / g++ (11.0 or 10.2) on Ubuntu 20.04 LTS
I'd like to get the latest releases of g++ (and clang) via package manager (apt).
Currently I need to compile gcc/g++ on my own which needs really a lot of time.
Are there any repositories with "...
5
votes
2
answers
36k
views
How do I install gcc 10.2 with sudo apt-get install gcc-x g++-x?
I was able to install gcc 10 but I need 10.2 not 10 and it keeps telling me gcc10.2 does not exist, well it does and I tried installing it by compiling and building it in the command line however that ...
5
votes
1
answer
12k
views
How can I force an older version of g++ if I have a newer version?
g++ --version on my home machine reads 7.4.0, but a server I frequently do work on shows 4.8.5. Their servers don't support -std=c++11 compiler flags yet my home machine does. The most recent flag it ...
5
votes
5
answers
29k
views
Eclipse Juno C++ error: Program "g++" not found in PATH
I installed the newest Eclipse Juno manually (not through software center nor apt-get), and then install Eclipse CDT from the help > install new software menu.
However, when I try to compile a simple ...
5
votes
2
answers
1k
views
Can I write an alias that takes an argument? [duplicate]
I have some remote machines, where I need to compile some source code.
What I normally do is write an alias, that says something like:
alias g++='g++ `pkg-config --cflags opencv --libs opencv`'
Then ...
5
votes
2
answers
13k
views
How to install gcov that is compatible with gcc version 10.1?
I'm trying to use CLions interface to gcov but I'm not using the default g++ compiler (for Ubuntu 18.04). Therefore my version of gcov (7.5) is incompatible with my compiler (10.1).
How can I install ...
5
votes
1
answer
1k
views
How to install new versions of G++ that use the corresponding C++ standard library?
I am trying to install multiple versions of the g++ compiler for testing purposes.
I would like to be able to install g++ 4.9.3,5.1.0, 5.2.0, and 6.1.0.
I know that I can do
sudo add-apt-...
5
votes
2
answers
2k
views
When I attempt to remove g++ why does apt-get attempt to install it? [closed]
Note: Originally I had a long background explanation leading up to why I was trying to perform apt-get remove g++. I have deleted that as irrelevant after trying this in a clean install of 11.10 (32-...
5
votes
0
answers
997
views
Can we install older versions of gcc and g++ on ubuntu 20.04 [duplicate]
I currently have Ubuntu 19.10 with gcc 9.1.2
I want to install previous versions of gcc for CUDA 8 (gcc 5 in this case). But I am getting this error:
(base) ➜ ~ sudo apt-get install gcc-5 g++-5 ...
4
votes
2
answers
15k
views
Unable to install build-essential, held broken packages [duplicate]
So I was trying to set up my computer for development. I installed ubuntu 14.04 LTS. I wanted to write a hello-world-program. However I can not compile it. After some searching, I tried sudo apt-get ...
4
votes
4
answers
45k
views
Eclipse can't find index libraries of GCC or G++
The instalation of CDT Tools on Eclipse can't find on index libraries of GCC or G++, but the file is running. Ex:
include stdio.h (The comment doesn't accept <> and #) The are a yellow line ...
4
votes
2
answers
8k
views
Cannot compile an opencv source file (C++) using 'pkg-config --cflags --libs opencv'
I compiled an opencv file (C++) using command line
g++ facedetect.cpp -o facedetect 'pkg-config --cflags --libs opencv'
but I had error
g++: error: pkg-config --cflags opencv: No such file or ...
4
votes
1
answer
6k
views
Need gcc and g++ 4.8 in Ubuntu 22.04.1
I am currently in Ubuntu 22.04.1 version, but I use a software which strictly needs gcc 4.8 (as per installation guide). How can I install it?
sudo apt-get install g++-4.8
Reading package lists... ...
4
votes
1
answer
348
views
Set parameters for Ubuntu's alias
I have an example command as follows:
g++ main.cpp -o main -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -I/usr/local/include/opencv4
Running the entire above command will create ...
4
votes
1
answer
4k
views
I can't compile a C++ program with the g++ command
If I try compiling my C++ source file by the following command:
g++ a.cpp
it outputs:
The program 'g++' can be found in the following packages:
* g++
* pentium builder
try:
sudo apt-get intsall &...
4
votes
2
answers
14k
views
I am using ubuntu 20.04 LTS trying to get from GCC 9.4 to gcc 10 or higher
sudo apt-get install gcc-10 g++-10:
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-10 is already the newest version (10.3.0-1ubuntu1~20.04).
gcc-10 ...
4
votes
1
answer
6k
views
Error when trying to install g++ in Ubuntu shell in Windows 10 [duplicate]
After downloading the Ubuntu app from the Windows store, I tried to run
gcc --version and it showed command gcc not found same was the case for g++.
I tried to install using sudo apt install gcc and ...
4
votes
1
answer
2k
views
Does g++ compiler have graphical user interface?
As the question says, I wonder if the default ubuntu compiler, g++, has graphical user interface.
4
votes
1
answer
8k
views
How to integrate the default g++ compiler with vscode?
I installed Ubuntu 16.04LTS about a week ago. Also, I installed 'Visual Studio Code (VScode)' to do some c++ programming but I couldn't find any article on the Internet that explicitly explains how ...
4
votes
0
answers
4k
views
Package 'g++-4.8' has no installation candidate [duplicate]
So i recently updated to Ubuntu-20.04 and my g++-4.8 compiler got deleted
when i tried to reinstall it using "sudo apt-get install g++-4.8" i get an error:
"Package g++-4.8 is not available, but is ...