Learn how to solve when you try to compile program through Code::Blocks but it shows errors.

You have just installed CodeBlocks IDE. But Whenever you command to build and compile your C/C++ file, it failed to build and compile. What can you do now?

All Problem Solved Compiling Code in CodeBlock IDE in Ubuntu

First, If you didn't install GCC/G++, just go Terminal (Ctrl + Alt + T) and follow this instruction.

After installing GCC/G++ restart CodeBlocks and run again your C/C++ file. If it doesn't work, don't worry. But you have to install GCC/G++ to compile C/C++.
Otherwise your compiler will show g++ isn't installed.

If you don't know how to build/run and compile your first code in CodeBlock, just follow the instruction:

1. Launch CodeBlock
2. Create New Project
3. Choose Console Application → Go → Next → Choose C/C++
4. Insert the name of Project Name.
5. You can choose the directory where you want to save your project. But it is optional.
6. Next
7. After completing your project, double click on Project Name icon which locate left hand sidebar of IDE. Here you will see a main.c named file.
8. You are ready to create new file by Ctrl + Shift + N and save the file as filename.c or filename.cpp (as your requirement) and then write your code and build and compile.

If your compiler fail to build or compile after follow the above instruction and show the result Permission Denied, probably you save your file at Non-Linux File System. Don't worry. Save your workspace at Home Directory. I suggest you to save under Home folder.

I assure, You will be succeed to build and compile your first code in CodeBlocks IDE.

Happy Coding !

You can check this article: