1

I am compiling my simple "Hello world" C code using the following command:

  1. arm-linux-gnueabi-gcc-4.4 test.cpp -o test

    It generates an error:

    arm-linux-gnueabi-gcc-4.4: error trying to exec 'cc1plus': 
    execvp: No such file or directory
    
  2. My directory: /usr/lib/gcc/arm-linux-gnueabi/4.4.7 won't have any cc1plus file as the compiler is looking for cc1plus whereas my /usr/lib/gcc/arm-linux-gnueabi/4.6 has the cc1plus file.

My test.cpp is a simple "hello-world" program, which I am going to target for ARM processor.

Please suggest how to solve this problem.

3 Answers 3

3

Your file has .cpp extension, so gcc will try to compile with some settings for c++. cc1plus comes with g++ package, try installing it. I've faced a similar problem before.

  1. Install ARM g++ cross compiller

    sudo apt-get install g++-arm-linux-gnueabi
    
  2. Then use g++ instead gcc to get correct linking

    arm-linux-gnueabi-g++ test.cpp -o test
    
0

gcc is a C compiler g++ is a C++ compiler.

You're trying to compile a cpp file with the gcc compiler, try with the g++ compiler instead.

Use the following command to install a g++

sudo apt-get install g++

Regards, Rangineni Balu

0

gcc is a C compiler and g++ is a C++ compiler as mentioned in the answer from @rangineni balu.

But you can use gcc as well to compile a C++ program with -libstdc++ as shown below:

gcc -x c++ hello.cpp -lstdc++

Additional information:

How to install gcc

To compile the C program:

gcc hello.c -o hello

To run it:

./hello

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .