deepanshumunjal

Honorable
Nov 12, 2012
18
0
10,560
i have windows 7. i downloaded dosbox turbo c++. but when i try to run a graphics.h header file . it does not run.i also downloaded codeblocks.
but it said "this file has not been built yet".
what is the problem??
 

calmstateofmind

Distinguished
Jul 2, 2009
292
0
19,010
When you attempt to run a program from within an IDE, it has to go through several stages before it actually launches and begins running. These stages are generally compile, build and run.

Compile basically checks for any errors, and if none are found (or they're minor enough to only be warnings), the IDE will then translate your program into machine language to then be ran. The compile command only works on the current file you actively have open within the editor; it does not compile your entire project.

Because you can, and usually do, have more than one file in a program, you must compile the entire project before it can be ran. This is done by selecting "build", which should be somewhere near the compile option within the menus. Building a project also links necessary files, such as libraries, to your program. If everything is all good, you can then select the run command, which then creates an executable and launches your program.

So you need to build the program, or in other words compile the entire project, before you can successfully run your program.
 

calmstateofmind

Distinguished
Jul 2, 2009
292
0
19,010
Make sure that you've imported the graphics.h file to your project, and then add "#include <graphics.h>" (but without the parenthesis) at the beginning of your main.cpp file; or whatever you've named the main file.

Build and then run.