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!

1 Answers1

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__ */
Velkan
  • 3,681