Program "g++" not found in PATH on Ubuntu - c++

I have eclipse Luna installed on Ubuntu with no internet connection.
I tried to run the simple "Hello World" program but I encountered the error:
Program "g++" not found in PATH
I downloaded (on another computer and copied it) the g++_4.8.2-1ubuntu6_i386.deb and tried to install it:
sudo dpkg -i g++_4.8.2-1ubuntu6_i386.deb
and I got this error message:
dpkg: dependency problems prevent configuration of g++:i386:
g++:i386 depends on cpp (>= 4:4.8.2-1ubuntu6)
g++:i386 depends on gcc (>= 4:4.8.2-1ubuntu6)
g++:i386 depends on g++-4.8 (>= 4.8.2-5~)
g++:i386 depends on gcc-4.8 (>= 4.8.2-5~)
dpkg: error processing g++:i386 (--install)
How can I install that g++ properly with no internet connection?
I will be happy for some guidance.

You have to connect your computer to internet and update the OS.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Then Try to install g++

You could use apt-offline. You'll need to download and install the deb file using:
dpkg -i apt-offline_1.3.1_all.deb
This program will download dependencies on an online machine, ready for you to copy across to install on your offline machine.
Here's a link on how to use it.

Related

Unable to install g++ in ubuntu 20.04

I have seen some questions similar to this on this website old latest.
But none of them have been answered and I am unable to comment there because I have less reputation points.
When I run sudo apt install g++ I get the following error:
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++ : Depends: gcc (= 4:9.3.0-1ubuntu2) but it is not going to be installed
Depends: g++-9 (>= 9.3.0-3~) but it is not going to be installed
Depends: gcc-9 (>= 9.3.0-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
When I run sudo apt install build-essential
I get the following error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
build-essential : Depends: gcc (>= 4:9.2) but it is not going to be installed
Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I need to install g++ in ubuntu20.04.
Thanks for the help!
I found a work around by installing aptitude first.
I followed the following steps:
sudo apt-get install aptitude
Then aptitude gives a list of packages (none of which were installed)
and asks to keep those packages in the same version. Choose No (n).
Then aptitude asks to downgrade some packages. Choose Yes (Y).
Finally run the command: sudo aptitude install build-essential
After running the above command g++ was already install and I didn't need to separately install it.\

Cannot install llvm-9 or clang-9 on Ubuntu 16.04

I have not been able to install either llvm version 9 or clang version 9 on Ubuntu. We have installed them on Windows.
I have tried a command and saw this response.
sudo apt-get install llvm-9
Reading package lists... Done
Building dependency tree
Reading state information...
Done E: Unable to locate package llvm-9
I have also tried and saw this response.
sudo apt-get install clang-9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package clang-9
My /etc/apt/sources.list file contains
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9.0 main
I found the website and saw that the folder was llvm-toolchain-xenial-9. Trying that version did not work either.
What else can I do?
I have looked at downloading the binaries but am not sure what installation steps I might be missing. I am not interested in compiling source code.
The Clang/LLVM project provides Nightly build packages for Ubuntu and Debian.
See the https://apt.llvm.org
The goal is to provide Debian and Ubuntu [Clang and LLVM] packages ready to be installed with minimal impact on the distribution.
Packages are available for amd64 and i386 (except for recent Ubuntu) and for both the stable, old-stable and development branches (currently 8, 9 and 10).
Packages are built using stage2 and extremely similar to the one shipping in Debian & Ubuntu.
To use:
Add the appropriate repositories to the /etc/apt/sources.list file; there are distinct repos for different Debian and Ubuntu versions.
Add the apt key (shown in the link).
Run an apt update to refresh the cache.
Add packages with apt install clang-9 (or other package as desired).
If something "did not work" using the vetted package system, diagnose that issue directly. Xenial has Clang/LLVM 9 packages, and I've recently installed the packages into Disco.
The described symptom ("Unable to locate package") sounds as though one neglected to run apt update, in which case the packages from the newly-added sources would not be visible to apt. This is a tool-usage issue, not a lack of available packages.
LLVM INSTALLATION STEPS
-----------------------
LLVM Compiler Prerequisites:
OPERATING SYSTEM : Ubuntu 16.04 LTS
RAM : Minimum 16GB to 32GB
SWAP MEMORY : Minimum 10GB to 20GB
MEMORY NEEDED : Minimum 70GB
Install CMake version 3.5.1:
$sudo apt install cmake
LLVM Compiler Installation Steps
Step1:
#download llvm from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
#download clang from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
#extract files into folders:
tar -xf cfe-8.0.1.src.tar.xz
tar -xf llvm-8.0.1.src.tar.xz
#change directory names to llvm8 and clang
mv cfe-8.0.1.src clang
mv llvm-8.0.1.src llvm8
Step2 : #change present working directory to llvm_source_directory here it is llvm8
$cd llvm8
##create build directory
$mkdir build
##change pwd to build directory
$cd build
#Build (PATH =/llvm8/build)
#execute following command in build directory:
$cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../
Step3: #execute make command in pwd:
/llvm8/build$ make
Step4 : #after 100% of linking process execute following command in build directory:
$sudo make install
$ sudo reboot
step5 : #after installation restart your system!
#for checking llvm installation type
$llvm-config --version #it shows 8.0.1
$clang --version #it shows 8.0.1
Here are the commands for LLVM 9:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-9 libclang-9-dev llvm-9-dev

fatal error: openssl/rsa.h: No such file or directory

I got this error when I executed g++ mycode.cpp, and this .cpp file include a line #include<openssl/rsa.h>. Now, I know the error's reason, and I have tow plan to resolve it:
I can add the openssl path to /etc/profile,
or I also can copy openssl folder to /usr/include, so I did the first plan, like this:
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/mylib
export CPLUS_INCLUDE_PATH
(my openssl folder's path is /mylib/openssl)
and I got this error again.
Then I try second plan, and it passed complie,(like this /usr/include/openssl).
Now, my problem is,
why the header ("openssl/rsa.h") can be found under /usr/include/ but can not be found under /mylib/, even I had add the path(/mylib) to /etc/profile?
To install OpenSSL on Debian, Ubuntu, or other derivative versions:
$ sudo apt-get install libssl-dev
To install the OpenSSL development kit on Fedora, CentOS, or RHEL:
$ sudo yum install openssl-devel
After installation, try to recompile the program.
Try to reinstall the library using the apt-get
sudo apt-get install libssl-dev

Poco/Data/SQLite/Connector.h: No Such file or directory

Asked a similar question recently but trying to simplify it since no one have been able to help.
I'm trying to compile a c++ program and I keep getting the error that it can't find Poco/Data/SQLite/Connector.h.
using: #include "Poco/Data/SQLite/Connector.h"
I've ran about a dozen installs trying to get this to work including:
sudo apt-get install openssl libssl-dev
sudo apt-get install libiodbc2 libiodbc2-dev
sudo apt-get install libpoco-dev
sudo gmake -s install under the downloaded libpoco dir.
I even see src/connector.cpp installed with the last.
New to C++ and Linux (raspbian on the pi 2), but can't seem to get the code to find this library.
Any suggestions?
In case anyone else has this issue.
libmysqlclient-dev needs to be installed first for these libraries to get installed with the poco install. Just doing mysql-client doesn't do it.
Change your path "Poco/Data/SQLite/Connector.h" to "Poco/Data/SQLite/connector.h". Hope this will help.

how do I install libGLEW 1.5 for sfml 2.0?

I tried to install sfml 2.0 and indeed i'm still trying. I have a problem. When I compile it says: libGLEW.so.1.5, needed by sfml/lib/libsfml-graphics.so, not found
when I try to install it with command by typing sudo apt-get install libGLEW-dev
I get glew 1.9 which don't work and make me keep have the same error message. How do I get libGLEW.so.1.5 for sfml 2.0?
between I'm on a ubuntu based operating system~
this answer is probably only for amd64.
get the .deb package here(the second under "Downloadable files") https://launchpad.net/ubuntu/quantal/amd64/libglew1.5/1.5.7.is.1.5.2-1ubuntu4
(if it's 32 bit try downloading it here http://glew.sourceforge.net/ )
than double click it or type the folowing commands on your terminal:
cd folderwherethepackageis
sudo dpkg -i nameofthepackage
sorry if there is any english errors.
You just need to create a symlink:
sudo ln -s /dev/lib/libGLEW.so.1.9 /dev/lib/libGLEW.so.1.5