1

i am new Linux user. Currently installed Ubuntu 14.04 LTS. I have installed code Blocks from Ubuntu Software Center. i have tried to create c file. But the problem is that after creating any Projects or Empty file when clicking the build and Run option it is showing that the project has not build yet. In the build log the following message has shown

gcc   -c /home/u/ProGrams/C_CodeBlocks/TestProject/main.c -o /home/u/ProGrams/C_CodeBlocks/TestProject/main.o
g++  -o /home/u/ProGrams/C_CodeBlocks/TestProject/main /home/u/ProGrams/C_CodeBlocks/TestProject/main.o   
/bin/sh: 1: g++: not found
Process terminated with status 127 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Checking for existence: /home/u/ProGrams/C_CodeBlocks/TestProject/main
Executing: terminology -M -T '/home/u/ProGrams/C_CodeBlocks/TestProject/main' -e  /usr/bin/cb_console_runner "/home/u/ProGrams/C_CodeBlocks/TestProject/main" (in /home/u/ProGrams/C_CodeBlocks/TestProject)
Process terminated with status 255 (0 minute(s), 34 second(s))

Then searched net, found some solutions that the compiler may not set as gcc. I have only one complier in my machine,in time creating project, i have selected the gcc compiler. But the problem remain Same.

Another solution that Settings-> Compiler-> Toolchain executables i have selected once Auto-Detect option and once the /usr/bin. But the problem not gone.

Help me to solve this problem...! If any additional information needed, please dont forget to tell.

Black Swan
  • 813
  • 13
  • 35
  • 2
    `gcc` looks fine, install `g++`. – Sourav Ghosh Apr 27 '15 at 11:53
  • would u please tell me how to install g++? – Black Swan Apr 27 '15 at 11:56
  • Try replacing `g++` by `gcc`. I don't know why codeblocks uses g++, as the end-user should only use gcc, which is a front-end tool, designed to call the correct compiler, depending on some context (file extension mostly, I think) – kebs Apr 27 '15 at 11:57
  • maybe [this](http://askubuntu.com/q/481807/402324) will help? – Sourav Ghosh Apr 27 '15 at 11:58
  • u@u-HP:~$ sudo apt-get install g++ Reading package lists... Done Building dependency tree Reading state information... Done E: The package virtualbox-4.3 needs to be reinstalled, but I can't find an archive for it. What can be done now. @Sourav Ghosh – Black Swan Apr 27 '15 at 12:09
  • then maybe [this](http://askubuntu.com/q/427362/402324) can help? – Sourav Ghosh Apr 27 '15 at 12:13
  • @kebs: Why shouldn't codeblocks use g++? – Keith Thompson Dec 06 '16 at 16:54
  • @KeithThompson Well, it could, sure. But kinda not necessary, as a front-end, gcc is supposed to handle all the language issues. For further info, check [this useful question](http://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc). – kebs Dec 06 '16 at 17:23
  • @kebs: The `g++` command takes care of figuring out which libraries are implicitly required for C++ code. Why should codeblocks reinvent that wheel? I certainly don't use the `gcc` command when I compile C++ code from the command line; I use `g++`. – Keith Thompson Dec 06 '16 at 19:08
  • @KeithThompson Yeah you got a point, I might have missed that. I actually only use C::B for editing (pretty nice, IMHO), but use makefiles for build, and use `$(CXX)`, which expands to ... `g++` – kebs Dec 06 '16 at 21:47
  • @kebs: Also installing the `g++` package installs the GNU C++ compiler as well as the `g++` frontend command. – Keith Thompson Dec 06 '16 at 21:48

1 Answers1

1

Install g++

Go to your terminal(ctrl+alt+T) and type

sudo apt-get install g++

Community
  • 1
  • 1