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:
* g++
* pentium-builder
Try: sudo apt-get install <selected package>
Then I tried…
nawshad@ubuntu:~/Thesis/Codes/Thesis_Utility_Function/Test Codes$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
g++ : Depends: g++-4.6 (>= 4.6.3-1~) but it is not going to be installed
libqt4-opengl : Depends: libqtcore4 (= 4:4.8.1-0ubuntu4.1) but 4:4.8.1-0ubuntu4 is to be installed
Depends: libqtgui4 (= 4:4.8.1-0ubuntu4.1) but 4:4.8.1-0ubuntu4 is to be installed
libqt4-svg : Depends: libqtcore4 (= 4:4.8.1-0ubuntu4.1) but 4:4.8.1-0ubuntu4 is to be installed
Depends: libqtgui4 (= 4:4.8.1-0ubuntu4.1) but 4:4.8.1-0ubuntu4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
But cant install due to unmet dependencies.
Best Answer
Run:
You should always run that before installing or upgrading packages on the command-line (unless you've run it very recently). It fetches information about what packages are available in what versions from where.
You may simply be able to install
g++
now, but go ahead and do as Web-E says (after running the above command), to fix any currently broken dependencies:(The
-f
can actually go before or after theinstall
; the effect is the same.)Then try installing
g++
again:If that still fails, please edit your question to show any error messages (and also the output of the above two commands when you ran them). But it should succeed.