C ++图形不起作用(未定义引用..)

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;
}



给出的错误如下:

1.未定义引用'initgraph'

2.未定义引用'circle'

3.未定义引用'延迟'

4.未定义引用'closegraph'

当前上:-ubuntu 16.04 -codeblocks 16.01

感谢您的帮助。



我尝试过:



没什么,第一个程序使用graphics.h

尝试在线搜索但没有帮助


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

使用过的图形函数和头文件 graphics.h 属于古代 Borland Turbo C - 维基百科 [ ^ ]和 Turbo C ++ - 维基百科 [ ^ ]用于创建MS-DOS程序的IDE和编译器。



要在Linux中使用它们,您必须安装兼容的库,如 libgraph - Summary [Savannah] [ ^ ]或 SDL_bgi和libXbgi库 [ ^ ]。



您可以将这些库用于学习目的。但它们不应该用于发布应用程序,最好使用更新的技术,而不是花时间在没有人使用anmyore的古老图形界面上。
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.