How to use graphics.h in codeblocks?

前端 未结 5 994
予麋鹿
予麋鹿 2020-11-27 20:39

I have recently started learning graphics in C++.

I tried #include in my program in codeblocks but it shows error. Then I downloaded

相关标签:
5条回答
  • 2020-11-27 21:02
    • Open the file graphics.h using either of Sublime Text Editor or Notepad++,from the include folder where you have installed Codeblocks.
    • Goto line no 302
    • Delete the line and paste int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX, in that line.
    • Save the file and start Coding.
    0 讨论(0)
  • 2020-11-27 21:12

    AFAIK, in the epic DOS era there is a header file named graphics.h shipped with Borland Turbo C++ suite. If it is true, then you are out of luck because we're now in Windows era.

    0 讨论(0)
  • 2020-11-27 21:16

    If you want to use Codeblocks and Graphics.h,you can use Codeblocks-EP(I used it when I was learning C in college) then you can try

    Codeblocks-EP http://codeblocks.codecutter.org/

    In Codeblocks-EP , [File]->[New]->[Project]->[WinBGIm Project]

    It has templates for WinBGIm projects installed and all the necessary libraries pre-installed.

    OR try this https://stackoverflow.com/a/20321173/5227589

    0 讨论(0)
  • 2020-11-27 21:17

    You don't only need the header file, you need the library that goes with it. Anyway, the include folder is not automatically loaded, you must configure your project to do so. Right-click on it : Build options > Search directories > Add. Choose your include folder, keep the path relative.

    Edit For further assistance, please give details about the library you're trying to load (which provides a graphics.h file.)

    0 讨论(0)
  • 2020-11-27 21:25
    1. First download WinBGIm from http://winbgim.codecutter.org/ Extract it.
    2. Copy graphics.h and winbgim.h files in include folder of your compiler directory
    3. Copy libbgi.a to lib folder of your compiler directory
    4. In code::blocks open Settings >> Compiler and debugger >>linker settings click Add button in link libraries part and browse and select libbgi.a file
    5. In right part (i.e. other linker options) paste commands -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
    6. Click OK

    For detail information follow this link.

    0 讨论(0)
提交回复
热议问题