Friday, October 28, 2022

[SOLVED] Code::Blocks build and run is not working on Chromebook

Issue

Whenever I try to build and run any C++ code (I didn’t try it with other programming languages) in Code::Blocks, a prompt pops up saying this:

it seems that the project has not been built yet. Do you want to build it now?"

with three options of No, Cancel, and Yes.

Screenshot of the dialog with buttons "No", "Cancel", and "Yes"

When I click Yes, the prompt closes, and it says this in the build log:

-------------- Build: Debug in main (compiler: GNU GCC Compiler)---------------

g++ -Wall -fexceptions -g  -c /home/sudo/codeblocks/main/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/main obj/Debug/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))

Enter image description here

I use Debian on a Chromebook I have tried some solutions, but so far nothing has worked. I don't know if this matters, but the file is in a console application project or something.


Solution

You must install g++ to compile C++ code. According to this question, you can use these commands to install it:

sudo apt update
sudo apt upgrade

sudo apt install build-essential
sudo apt install software-properties-common

sudo apt install gcc g++


Answered By - cs1349459
Answer Checked By - Marilyn (WPSolving Volunteer)