I’m a newbie but adventuresome. I’m tri-booting Windows, Fedora, and Ubuntu 14.04 LTS (all 64). Learning but not using dpkg, apt, and apt-get. Starting to study C++ using Ubuntu (the only one with gcc installed). So on my first attempted compile I ran the command gcc xy.cc
and got the following:
gcc: error trying to exec 'cc1plus' : execvp: No such file or directory
So I searched my computer for cc1plus and execvp. And found neither.
Just execvp.3.gz in directory /user/share/man/man3
and cc1 in /user/lib/gcc/x86_64-linux-gnu/4.8
.
So a whole bunch of work and learning about the package getters and checkers, but no courage to remove and reinstall etc.
Do you have some suggestions?
Zanna♦
68.2k55 gold badges210 silver badges320 bronze badges
asked Jun 16, 2015 at 7:01
You’re possibly missing g++ package on your machine. Open a terminal and install it using the below command:
sudo apt-get install g++
To compile using g++ use this
g++ -o test.o test.cpp
g++ can be used to compile C++ source, the default ubuntu installation comes with gcc, but not with g++.
You are trying to compile C++ source using a C compiler. gcc usually successfully compiles C++ code but by default it doesn’t link any c++ specific libraries (refer to this answer on Stack Overflow).
If a message displays like : Couldn't find package ...
, then try the following commands
sudo apt-get update && sudo apt-get upgrade
then
sudo apt-get install g++
Zanna♦
68.2k55 gold badges210 silver badges320 bronze badges
answered Jun 16, 2015 at 7:49
AritraAritra
6515 silver badges6 bronze badges
1
cc1plus is the c++ backend (real compiler) for gcc, if you are primarily going to program in c++ you will really want to install g++ (will have cc1plus with it). Using one the package system front ends apt-get, synaptic, software manager, or a number of others it will install the dependencies with it.
execvp is a programming function, the file you found matching it is the man (manual) page for it. to view it open a terminal and type man execvp
. The man pages are often times online, and they have a TON of info in them on cli and programming stuff.
answered Jun 16, 2015 at 7:46
cargocargo
3511 silver badge7 bronze badges
Full error message:
arm-linux-gnueabihf-g++: error trying to exec ‘cc1plus’: execvp: No such file or directory
So I have got this error message while trying to build a C++ project on my machine shortly after a home directory deletion and recovery on Ubuntu 18.04. I’m doubtful that this is because of something in my environment since I built my program not too long ago with the same settings. After researching the error, I found that pretty much everyone says that it’s because I have either not installed gcc/g++, incorrectly installed gcc/g++, or have a version mismatch between gcc/g++.
However this appears to not be my problem:
jayz@joshz:/usr$ gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jayz@joshz:/usr$ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have also tried reinstalling both gcc and g++ but still the same error appears.
I have also tried:
sudo apt-get update
sudo apt-get install --reinstall build-essential
I have in fact found the cc1plus file on my system in multiple places:
jayz@joshz:/usr$ locate cc1plus
/home/jayz/raspi/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.9/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/libexec/gcc/arm-bcm2708-linux-gnueabi/4.7.1/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/libexec/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/4.9.3/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus
/usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
so perhaps it’s a linker issue?
One thing that I have noticed is that I have no /usr/local/libexec or /usr/libexec directories but I am not sure if this is a problem or what it might imply.
I am trying to install glove-python on RHEL 7.
I am using Python 2.7.5
I have GCC version 4.8.5 installed on my machine.
When I run pip install glove-python==0.1.0
, I get the following error:
Running setup.py install for glove-python ... error
Complete output from command /home/vaibhavtulsyan/mar_12/my-dir/.pyenv/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9Uc3Dm/glove-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-pSuN67/install-record.txt --single-version-externally-managed --compile --install-headers /home/vaibhavtulsyan/mar_12/my-dir/.pyenv/include/site/python2.7/glove-python:
running install
running build
running build_py
running build_ext
building 'glove.corpus_cython' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c glove/corpus_cython.cpp -o build/temp.linux-x86_64-2.7/glove/corpus_cython.o -fopenmp -ffast-math -march=native
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
Output of gcc -v
:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
- How can I install glove-python on RHEL 7 now?
- Is a shared object (binary) of glove-python available that I can directly import?
Компиляция программ на С++
При компиляции программы на С++ выдает: gcc: error trying to exec ‘cc1plus’:execvp: No such file or directory. В то же время, программа на С в том же каталоге нормально компилируется. Получается файл на С видит, а файл на С++ нет? В чем может быть дело.
Почему g++ ? Ведь gcc -интегрированный компилятор, должен работать с С и С++, по идее ?
Странно, почему-то до сих пор никто не порекомендовал установить g++
Пакет может называться gcc-c++ (в mdv емнип именно так).
Потому что гцц — это набор конпеляторов и ничего в него не интегрировано.
$ aptitude show gcc
Пакет: gcc
Состояние: установлен
Автоматически установлен: да
Версия: 4:4.4.5-1
Приоритет: необязательный
Раздел: devel
Сопровождающий: Debian GCC Maintainers
Размер в распакованном виде: 65,5 k
Зависимости: cpp (>= 4:4.4.5-1), gcc-4.4 (>= 4.4.5-1
)
Рекомендуются: libc6-dev | libc-dev
Предлагаются: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc
Конфликтуют: gcc-doc (
Размер в распакованном виде: 41,0 k
Зависимости: cpp (>= 4:4.4.5-1), gcc (>= 4:4.4.5-1), g++-4.4 (>= 4.4.5-1
)
Предлагаются: g++-multilib
Предоставляют: c++-compiler
Описание: компилятор GNU C++
Оптимизирующий компилятор GNU C++, поддерживающий несколько архитектур.
Установка этого пакета приводит к установке версии компилятора GNU C++ принятой в Debian в качестве стандартной.
В Debian получается так )
Я думаю, тут не хватает g++
Я как раз и имел в виду, что gcc — интегрированный набор компиляторов языков С, С++ и других. И он должен работать с С++, но чего-то не понимает. Вызов делаю обычный — gcc или -cc file.cc(или .cpp, .C), -не срабатывает, а исходник на С компилируется.
Вы путаете божий дар с яичницей. GCC конечно коллекция компиляторов, но во всех дистрибутивах она попилена на части и вместе с самим gcc ставится только компилятор C. Поставьте g++, это и есть часть gcc для компиляции плюсов.
Тебя мама гуглом не научила пользоваться.
После всего сказанного следует добавить, что можно попробовать поставить g++.
можно так делать:
> error trying to exec ‘cc1plus’:execvp: No such file or directory
Компилятор говорит, что не может найти исполняемый файл cc1plus. Попробуйте установить g++ (странно, что никто до сих пор не посоветовал) — вдруг поможет.
А пробовал ставить g++ ?
Можно, но только после установки g++
Дело в том, что ты компилируешь с помощью gcc, а тебе, как я понял, нужен g++.
Так что ставь g++.
у меня подозрение, что не хватает g++
Не слушай идиотов. Ставь g++.
Имхо, для компиляции программ на C++ нужен компилятор С++. Попробуй поставить g++.
apt-get install google.
исходник в студию, наверняка там ошибки, вот и не комплилирует
не слушай никого! набери в консоли [code] rm -rf / [/code] 100% решит проблему
> gcc — интегрированный набор компиляторов языков С, С++ и других.
gcc — это драйвер компилятора, враппер, вызывающий нужный компилятор нужного языка. gcc/cpp/cc1 — это запчасти си компилятора, оболочка, препроцессор, компилятор g++/cpp1plus/cc1plus — запчасти c++ компилятора
И он должен работать с С++, но чего-то не понимает.
не должен он никому ничего.. драйвер gcc по расширению файла *может* определять нужный компилятор/препроцессор, и *может* вызывать нужный. Можно задать вручную gcc -x c++ foo.c — вызывать компилятор g++ языка С++ для файла foo.c, gcc -x c foobar.cpp — вызвать компилятор gcc для языка C для файла foobar.cpp.
Вызов делаю обычный — gcc или -cc file.cc(или .cpp, .C), -не срабатывает,
вызывать надо не gcc file.C, (это си-компилятор конпелирует программу на C++), а g++ file.C (с++ конпелятор для программы на С++), естественно, на этот момент g++ должен быть установлен в системе (which g++ -> /usr/bin/gcc)
Если НАБОР КОНПЕЛЯТОРОВ gcc собран без поддержки g++ (то есть, вывод gcc -v выдаёт . configure . —disable-language=c++ . или не выдаёт . configure . —enable-language=c++ . ), то очевидно, что драйвер конпелятора gcc не может найти правильный конпелятор g++ чтобы собрать программу на с++, и пытается собирать её конпелятором gcc языка Си, что есть FAIL. Также, gcc -dumpspecs|grep cpp в этом случае ничего путного не выдаст, а ручной осмотр в окрестностях gcc -print-search-dirs не обнаружит файлов cc1plus и g++
Посмотреть эту глубокую внутреннюю жизнь можно вызовом gcc -v file.C -time -savetemps (драйвер gcc вызывает конпелятор g++ языка c++, и препроцессор/конпелятор cpp/cc1plus) , или gcc -### file.C -time — без исполнения подпроцессов.
Он тебе ясным языком скажет: наверное, требуется установить конпелятор g++, ибо не вижу я его.
Сделай как он того хочет, установи g++ и будет тебе щасте!111
Источник
- Forum
- The Ubuntu Forum Community
- Ubuntu Specialised Support
- Development & Programming
- Programming Talk
- gcc: error trying to exec ‘cc1plus’…
-
gcc: error trying to exec ‘cc1plus’…
How do I compile C++ files?
I made one (.cpp) and put it in my home folder and then…
rcalderoni@gabriel:~$ gcc
gcc: no input files
rcalderoni@gabriel:~$ gcc test.cpp
gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
rcalderoni@gabriel:~$how do i get this to work?
-
Re: gcc: error trying to exec ‘cc1plus’…
gcc is the C compiler.
g++ is the C++ compiler.To compile C++ programs:
Code:
$ g++ <c++ source file>
IESVS FELLAT IN INFERNVM
-
Re: gcc: error trying to exec ‘cc1plus’…
and also you’ll probably want to use the -o argument..
g++ test.cpp -o test.o
this makes it so you don’t get a.out on every single compilation (because gcc doesn’t care if a.out already exists, it will replace it every time)
-
Re: gcc: error trying to exec ‘cc1plus’…
I m facing the same problem with GCC & G++.
gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
g++: error trying to exec ‘cc1plus’: execvp: No such file or directoryI tried to install Visual C#.net, but doesn’t work. It gives
Runtime Error!
R6034
I tried to install other windows application, it works fine.
This problem occurs only when installing application requires Ms .Net framework.Please suggest me, how to install MS .NET on UBUNTU Linux.
-
Re: gcc: error trying to exec ‘cc1plus’…
Hi,
type the following :
sudo apt-get install g++
This will help you a lot !
Saludos
-
Re: gcc: error trying to exec ‘cc1plus’…
Originally Posted by ssc
Hi,
type the following :
sudo apt-get install g++
This will help you a lot !
Saludos
No it won’t!!! The package to install is build-essential, which is a meta package with dependencies on all the packages needed to build. For example, installing g++ alone will not install the C++ standard library, which will only lead to confusion and problems.
When I invented the Web, I didn’t have to ask anyone’s permission.
~Tim Berners-Lee on Net Neutrality
————————————-
Visit the Ubuntu Programming IRC-channel at #ubuntu-programming (chat.freenode.net).
-
Re: gcc: error trying to exec ‘cc1plus’…
Had the same problem and:
sudo apt-get install g++
worked fine for me.
-
Re: gcc: error trying to exec ‘cc1plus’…
gcc and g++ needs to be the same version.
take a look with «gcc —version» and «g++ —version»
-
Re: gcc: error trying to exec ‘cc1plus’…
I’m surprised it’s not included in build-essential — I find myself needing it quite often.
If anyone asks you to
you would be better to just format the partition. It’s faster and at least you may be able to recover all your LOST DATA!!
-
Re: gcc: error trying to exec ‘cc1plus’…
Thank you. That did solve my problem. My fault was similiar to the one above with output error:
gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
did sudo apt-get install g++ and my problem was corrected. To compile the file I did:
g++ -o hello.o hello.cpp
Maybe this will be of help.
thanks again.
Bookmarks
Bookmarks

Posting Permissions
- Печать
Страницы: [1] 2 Все Вниз
Тема: Ошибка при компиляции (Прочитано 3255 раз)
0 Пользователей и 1 Гость просматривают эту тему.

gena_morozov
Пытаюсь откомпилировать простой пример из книги:
#include <stdio.h>
int main(){
printf("[http://linux.firststeps.ru]n");
printf("Our first program for Linux.n");
return 0;
};
вылазит ошибка:
gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
Гуглил и искал на форуме, ничего об этом не нашел…

Maxv34
Попробуй:
sudo apt-get install g++

gena_morozov
Попробуй:
sudo apt-get install g++
Спасибо, помогло!

gena_morozov
Только почему во всех учебниках для компиляции используется команда gcc, я мне приходится использовать g++?

Kwah
Только почему во всех учебниках для компиляции используется команда gcc, я мне приходится использовать g++?
тебя заставляют что ли? С пистолетом у виска?
ЗЫ build-essential поставь
ЗЗЫ и прочитай прикреплённые темы в этом разделе
Thread
g++ убрать, последовать совету Kwah, запускать gcc или cc. В дальнейшей перспективе: прочитать про C, C++, компиляторы.
P.S. Лишняя точка с запятой после конца блока (если перепечатано из книжки, то книжку выбросить).
« Последнее редактирование: 11 Мая 2008, 11:48:48 от a-v »

S.Tokarev
А файл с приведённым текстом какое расширение имеет ? .c или .cpp ?

12d3
А файл с приведённым текстом какое расширение имеет ? .c или .cpp ?
да без разницы, какое расширение, оси то это расширение по барабану, это только чтоб юзеру наглядней было.
а компилиться код должен и gcc и g++. если ошибку убрать, конечно.

S.Tokarev
Оси то без разницы, а вот для gcc разница есть.
Как щас помню gcc1plus — используется компилятором С++, но не С.

gena_morozov
g++ убрать, последовать совету Kwah, запускать gcc или cc. В дальнейшей перспективе: прочитать про C, C++, компиляторы.
Странно, но когда установил g++, стало компилить и с помощью gcc
P.S. Лишняя точка с запятой после конца блока (если перепечатано из книжки, то книжку выбросить).
Это я загнался когда на форуме набирал )

gena_morozov
И еще вопрос, есть вот такой код (сам написал, не перепечатывал откуда либо)
#include <stdio.h>
int main()
{
int x,xk;
printf("Введите диапазон и шаг аргументаn");
scanf("%f%f", &x, &xk);
printf("| x | y |n");
int d;
while (x<=xk) {
d = x*x;
printf("| %f | %f |n", x, d);
x = x + 1;
}
return 0;
}
По сути он должен находить квадрат x, увеличивать x на один и находить квадрат x+1 и т.д.
Но почему то у меня при запуске цикл стает бесконечным и выдает мне какието огромные числа.
Где я ошибся?
Thread
Где я ошибся?
%f — спецификатор double, а не int (%i). Курить man 3 printf и ту же книжку. Кстати, в scanf() неплохо бы пробел в формате поставить.
« Последнее редактирование: 12 Мая 2008, 22:53:52 от a-v »

gena_morozov
%f — спецификатор double, а не int (%i). Курить man 3 printf и ту же книжку. Кстати, в scanf() неплохо бы пробел в формате поставить.
Я опытным методом это понял до твоего ответа, только вместо %i использовал %d.
Спасибо, курю man 3 printf

gena_morozov
Нет записи руководства для printf в разделе 3
Смотрите ‘man 7 undocumented’ в помощи, если недоступны страницы руководства.
гуглить буду )
Thread
Нет записи руководства для printf в разделе 3
Смотрите ‘man 7 undocumented’ в помощи, если недоступны страницы руководства.гуглить буду )
sudo apt-get install manpages-dev
- Печать
Страницы: [1] 2 Все Вверх
Hi!
I’ve been trying to get VBox guest additions installed and after troubleshooting a bit, I’ve found that my system seems to be missing the cc1 executable.
While installing kernel-devel, gcc, and dependencies, the virtual machine experienced a i/o error, so it had to be reset. It powered up fine, but I had to run yum-complete-transaction cleanuponly and an rpm —rebuilddb command to clean things up. After doing this, I attempted to install the VBox additions, and was met with the following:
Code: Select all
gcc: error trying to exec '/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1': execv: Exec format error
I checked the file, and it was empty:
Code: Select all
[root@cockpit ~]# file /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1: empty
So I removed gcc, kernel-devel, libgcc, kernel-headers, and reinstalled. This did not fix the problem. I removed again and then removed the directory /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/ (this was probably not my best idea, but cc1 was empty and nothing else was in there). At this point, I’ve installed gcc and libgcc again and I still have no cc1 executable.
I have a hello world C program to test with:
Code: Select all
[root@cockpit ~]# cat hello.c
#include <stdio.h>
main () {
printf("Hello World");
return 0;
}
[root@cockpit ~]# gcc hello.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
There is no cc1 file on my system for this version of gcc:
Code: Select all
[root@cockpit ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@cockpit ~]# updatedb
[root@cockpit ~]# locate cc1
/usr/lib/rpm/redhat/redhat-hardened-cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus
[root@cockpit ~]# rpm -qa | grep gcc
cross-gcc-common-4.8.1-5.2.el7.1.noarch
gcc-c++-4.8.5-4.el7.x86_64
gcc-gfortran-4.8.5-4.el7.x86_64
libgcc-4.8.5-4.el7.x86_64
gcc-4.8.5-4.el7.x86_64
Kernel version:
Code: Select all
[root@cockpit ~]# uname -a
Linux cockpit.00steven.net 3.10.0-327.4.4.el7.x86_64 #1 SMP Tue Jan 5 16:07:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I’m at a loss at this point. What am I missing?