Click here to Skip to main content
15,915,869 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C++
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
int main()
{
    int gd = DETECT, gm;
    initgraph(&gd, &gm, NULL);

    circle(50, 50, 30);

    delay(500000);
    closegraph();
    return 0;
}

the errors given are as follows:
1.undefined reference to 'initgraph'
2.undefined reference to 'circle'
3.undefined reference to 'delay'
4.undefined reference to 'closegraph'
currently on: -ubuntu 16.04 -codeblocks 16.01
Thank you for the help.

What I have tried:

nothing much, first program using graphics.h
tried to search online but got no help
Posted
Updated 22-Mar-18 10:05am
Comments
Richard MacCutchan 22-Mar-18 13:29pm    
You version of graphics.h does not contain definitions for those library functions. Check the documentation for help.

1 solution

The used graphic functions and the header file graphics.h belong to the ancient Borland Turbo C - Wikipedia[^] and Turbo C++ - Wikipedia[^] IDE and compiler for creating MS-DOS programs.

To use them with Linux you have to install a compatible library like libgraph - Summary [Savannah][^] or The SDL_bgi and libXbgi Libraries[^].

You might use these libraries for learning purposes. But they should be not be used for release applications and it might be better to use a more recent technology instead of investing time on an ancient graphics interface that nobody uses anmyore.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900