C++ No Such File or Directory

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
LyleGomera
Level 1
Level 1
Posts: 2
Joined: Sun Mar 09, 2014 5:57 pm

C++ No Such File or Directory

Post by LyleGomera » Sun Mar 09, 2014 6:13 pm

This is my first time posting on this great forum, so hi everyone!

Now let's get to business. I'm trying to compile code with gcc, but I keep getting the error in the title. I tried #include <iostream>, #include <stdio.h>. I think I might need to put the headers/libraries in a place that the compiler can find them. But, I don't know what to put or where to put it. Thank you!

Code: Select all

la@lac ~ $ pwd
/home/la
la@lac ~ $ cd Desktop/CCPP/
la@lac ~/Desktop/CCPP $ gcc test.cpp
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
Last edited by LyleGomera on Sun Mar 09, 2014 8:22 pm, edited 1 time in total.

User avatar
jahid
Level 6
Level 6
Posts: 1221
Joined: Sat Dec 07, 2013 4:07 pm
Location: Khulna, Bangladesh

Re: C++ No Such File or Directory

Post by jahid » Sun Mar 09, 2014 7:13 pm

if you are doing it through command line, then you may have mistaken to specify the correct path for the source file.
jahid@HP ProBook 440 G1 Laptop

dagon
Level 7
Level 7
Posts: 1674
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: C++ No Such File or Directory

Post by dagon » Sun Mar 09, 2014 9:19 pm

LyleGomera wrote:$ gcc test.cpp
For C++ projects you need to call the 'g++' compiler.
Try:

Code: Select all

g++ test.cpp

LyleGomera
Level 1
Level 1
Posts: 2
Joined: Sun Mar 09, 2014 5:57 pm

Re: C++ No Such File or Directory

Post by LyleGomera » Sun Mar 09, 2014 9:53 pm

That worked. Thank you both.

User avatar
jahid
Level 6
Level 6
Posts: 1221
Joined: Sat Dec 07, 2013 4:07 pm
Location: Khulna, Bangladesh

Re: C++ No Such File or Directory

Post by jahid » Mon Mar 10, 2014 5:32 am

I didn't see your last edit, which says the path is correct but the compiler is not.
gcc stands for GNU C compiler and g++ stands for GNU C++ compiler. so if you are going to compile a cpp file then certainly you will need to use g++ instead of gcc.
jahid@HP ProBook 440 G1 Laptop

Post Reply

Return to “Software & Applications”