I have opened a project in CodeBlocks, which builds and runs successfully. Now if I open another C file in the IDE, the build and run command will act on the existing open project and not on the new C file. If there were multiple projects, we can switch between them using " activate project" . But what if there is one active project and another C file outside the project. How to complile and run the C file then ?
Under the Projects
tab on the left, right- click on your project and click Close project
. Do this for all projects that are open.
Now, if your C file is open, just press F9
to compile and run your program.
It is easy to compile and run a single C file in Code::Blocks:
File
-> New
-> Empty file
.c
extension.F9
to compile and run the program.