I have just switched to linux.
Thanks in advance!
73 Answers
Your C++ program is not running in Code::Blocks because you do not have a C++ compiler (a version of G++) installed, or if it is installed you have not configured the C++ compiler in the Code::Blocks compiler settings. The C++ compiler is not configured for any version of g++ in Ubuntu 18.04 by default, so it has to be configured in the Code::Blocks compiler settings.
Install the latest version of the g++ compiler for C++.
sudo apt install g++-8 xtermOptionally install the latest version of gcc too (recommended).
sudo apt install gcc-8-base # recommended versionStart Code::Blocks.
- Select Settings -> Compiler -> Global compiler settings (large blue gear icon in the left pane) -> Toolchain executables tab.
- Select the Program Files tab. It has already been selected in the below screenshot.
- Click the .. button(s) which are marked by the mouse cursor in the below screenshot. Navigate to
/usr/bin. The C compiler should be eithergccor optionallygcc-8, the C++ compiler should beg++-8and the Linker for dynamic libs should beg++-8. - Click the OK button to close the Compiler settings window.
I tried to install codeblocks in bionic and it was almost a night mare as so many dependencies are needed. In the case of the question OP was missing the xterm terminal that codeblocks uses to work and that can be found in the libwxbase3.0-0v5 package, when you try to install this it will complain then you run sudo apt install -f and it will install xterm as part of the dependencies.
Please note that the codeblocks download comes with the dependencies needed in the archive filecodeblocks_17.12-1_amd64_stable.tar.xz from their down load site.
Maybe ur problem is that you saved the file in the default format (.ads) provided by codeblocks. I had the same problem but solved it after I renamed my file extension from .ads to .cpp.
Hope this helps