c++ - 在代码块中运行我的第一个图形程序

标签 c++ codeblocks bgi

我正在尝试在代码块中使用 C++ 在图形中运行“线程序”。我已经在图形代码块中完成了环境设置。我仍然在这个程序中遇到问题。该程序没有显示任何错误,但是当我运行它时,它没有在输出中显示任何行。 Output my program is showing .这是我的代码:

#include <graphics.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{

int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\MinGW\\include\");
setcolor(4);
line(30,100,210,100);
line(30,101,210,101);
getch();
}

最佳答案

改变bgi的位置

把这个:

initgraph(&gdriver,&gmode,"..\\bgi\\");

关于c++ - 在代码块中运行我的第一个图形程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42892071/

相关文章:

c++ - 如何在 VS 2012 中查看 C++ 链接命令

c++ - 如何在不将库源添加到项目的情况下将库链接到 CodeBlocks & GCC 中的项目

c++ - 在代码块 13.12 上成功编译,但在 ideone 或 spoj 上编译错误

c++ - 用 C++ 编写状态机

c++ - 可移植图形API

c - 如何使用c中的像素值在GUI窗口中绘制图片?

c++ - 无法通过 C++ 警告 : (& crash after) deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

c++ - std::map 迭代在第一次运行时出错

c++ - 作为标准,C++ 是否禁止在单个类实例中存储成员函数?

c++ - D3D11 : How to draw GDI Text to a GXDI Surface?(无 D2D)