2

I have installed the codeblocks from ubuntu software center and used good enough time no problem but when i try to access functions from graphics.h library I'm getting errors so please help me adding the graphics.h from http://winbgim.codecutter.org/ to the code::blocks. Thanking you , guys!

0

1 Answer 1

1

WinBGIm graphics library is only for windows.

Possible options:

  • use original Pascal graphics library (with Pascal language obviously)
  • use different graphics library with C++
  • use winbgim with C++, but cross-compile the code of the program to get a windows binary and run it in wine

edit

There are newer implementations of BGI graph library: SDL_bgi and libXbgi.

Site: http://libxbgi.sourceforge.net/#download

Get the package sdl-bgi_2.0.2-1_i386.deb and install it:

sudo dpkg -i sdl-bgi_2.0.2-1_i386.deb

Or alternatively, if you want to have a 64 bit version, then get the sources - it is the SDL_bgi-2.0.2.tar.gz archive. And compile + install them:

cd src
make
sudo checkinstall

To compile your program from command line using SDL_bgi, make sure that it includes the 'SDL_bgi.h' header file. Then:

gcc -o program program.c -lSDL_bgi -lSDL2

But you are using Code::Blocks, so you'll have to add SDL_bgi and SDL2 to something like 'Link Libraries' in the project parameters.

If you have some non-crossplatform includes, then surround them with ifndef __linux__ directives:

#ifndef __linux__
#include <conio.h>
#include <dos.h>
#endif /* __linux__ */
4
  • I do not understand anything.
    – A.B.
    Jun 4, 2015 at 19:40
  • @A.B., the answer or the question? Probably they have to do some project at the university using C and winbgim . In the past there was Pascal with its 'graph' library. Then it was replaced by C and a port of the 'graph' library to windows (using GDI or something like that); port is called winbgim.
    – Velkan
    Jun 4, 2015 at 19:53
  • I appreciate for your your answer but can u be specific in answering directly? like in place of graphics.h or to make use similar kind of functions in code::blocks do v have any other alternatives ? Jun 7, 2015 at 20:42
  • Wow, I've suddenly found two possible replacements: SDL_bgi and libXbgi. Added to the answer.
    – Velkan
    Jun 8, 2015 at 18:44

Not the answer you're looking for? Browse other questions tagged .