How To Manage C++ Graphics Program In Code Blocks
Problem:
Code Block's GCC Compiler doesn't have dos based graphics library, so when you include graphics.h , it yields error message. This is because there is no such header files in the folder of our compile directory. The solution is given below:
Solution:
- Download The File From Here
- Extract the downloaded file. You will get three files :
- graphics.h
- winbgim.h
- libbgi.a
- Copy and paste graphics.h and winbgim.h files into the include folder
- Copy and paste libbgi.a to the lib folder of your compiler directory
- Open Code::Blocks. Go to Settings>>Compiler>>Linker Settings
- In that window , click the Add button under the "Link libraries" part , and browse and select the libbgi.a
- Go to "Other linker options" on the right part and paste these commands: -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
- Then Compile Your File Again and you are done.
You May Get Two Windows When You Run The Program . For that you should make the settings as:
- Make Project first. When you make new empty file then you cannot change the option.
- Go to Projects>>Properties>>Build Target and change the console application into GUI Application.
- Then again compile and run. And finally you are done.
Post a Comment