Помогаю со студенческими работами здесь
Bgi error: graphics not initialized (Use InitGraph)
При запуске программы с графикой пишет Bgi error :graphics not initialized(Use InitGraph)Пробовал…
Не могу подключить файлы из BGI для <graphics.h>
На этапе линка, компилятор (Borland C++ 6.0) выдает ошибку:
Fatal: expected a ‘:’ or ‘=’: bgi
…
Borland 3.1 Graphics
Есть код:
#include <conio.h>
#include <graphics.h>
#include <dos.h>
#include <math.h>
void…
Какой функцией изменить цвет фона окна windows bgi?
это окошко черное и белая надпись Hello.Мне нужно сделать его синим.Есть ли такая функция.Если…
Graphics.SetClip Method (GraphicsPath) и Graphics.Clear Method vs Graphics.FillPath Method (System.Drawing)
У нас два способа залить форму:
1. Graphics.SetClip Method (GraphicsPath) and Graphics.Clear
…
Windows 8.1 не видит Intel HD Graphics 630
Установил Windows 8.1 Профессиональная после Windows 10. Система не видит мою видеокарту. А если не…
Искать еще темы с ответами
Или воспользуйтесь поиском по форуму:
when i run simple graphics program Borland c++ throw Error «BGI graphics not supported under windows»
#include<graphics.h>
#include<conio.h>
void main() { int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\TC\BGI");
circle(100, 100, 50);
getch(); closegraph();
}
genpfault
50.5k10 gold badges85 silver badges136 bronze badges
asked Jun 18, 2013 at 6:41
2
Maybe you can try this:
go to Options -> Linker -> Libraries
then select the graphics library.
answered Apr 11, 2016 at 18:50
amolgautamamolgautam
8499 silver badges19 bronze badges
Run your program under MS-DOS or switch to another graphics library.
(BTW the last time I had something to do with BGI was in the 90s…)
answered Jun 18, 2013 at 6:49
AxelAxel
13.8k4 gold badges48 silver badges77 bronze badges
3
Well, one thing you can do is try turbo c++ compiler. Borland in new and doesn’t support BGI graphics. I had the same problem and it is much better to use turbo c++ (not 4.5 version). Last year I had to use them and Borland didn’t support them. I loved Borland compiler.
TIP: if you are not learning BGI graphics for some special reason, I would suggest you to use other graphic libraries in other compilers (like Code::blocks) which support new c++ standards.
answered Apr 11, 2016 at 18:56
Ayush MahajanAyush Mahajan
6311 gold badge5 silver badges13 bronze badges
WindowsXP, BorlandC++5.02 и <graphics.h>
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
Проблема такая. |
trainer |
|
Насколько я понял, ты пытаешься использовать BGI в программе, написанной под Win32. |
Мяут |
|
Ламер |
|
Цитата trainer @ 21.11.04, 12:08 Насколько я понял, ты пытаешься использовать BGI в программе, написанной под Win32. А что же мне, разнесчастному, делать, если нужны простенькие рисовательные инструменты (образно говоря, синусоиду нужно изобразить, или там тепловую волну бегущую) под Win32? |
trainer |
|
Под Win32 надо использовать WinAPI. |
Мяут |
|
Цитата trainer, 21.11.04, 12:55 Под Win32 надо использовать WinAPI. Уточню: GDI |
Ламер |
|
Прошу прощения за тупость и настырность. Вот так
#include <graphics.h> void main() { line (0,0,640,480,6); putpixel (100,100,6); } …, как мы выяснили, будет неправильно. Сообщение отредактировано: Leprecon — 21.11.04, 16:03 |
Lavrik |
|
Цитата Ламер, 21.11.04, 19:25 …, как мы выяснили, будет неправильно. инициализируем:
int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode,NULL); errorcode = graphresult(); if(errorcode != grOk){ printf(«Graphics error: %sn», grapherrormsg(errorcode)); printf(«Press any key to halt:»); getch(); exit(1); } дальше рисуем что хотим, в конце программы освобождаем:
closegraph(); Сообщение отредактировано: Lavrik — 21.11.04, 13:38 |
Ламер |
|
Инициализация, эт да. За 5 лет все забыл
#include <graphics.h> void main() { int gdriver=DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, NULL); errorcode = graphresult(); if(errorcode!=grOk) { printf(«Graphics error: %sn», grapherrormsg(errorcode)); printf(«Press any key to halt:»); getch(); exit(1); } line (0,0,640,480,6); closegraph(); } Все равно: Постинги Мяута и Трэйнера я понял так, что подключать надо вообще другую библиотеку. M Просьба использовать тег кода для оформления |
Lavrik |
|
Цитата Ламер, 21.11.04, 21:02 Постинги Мяута и Трэйнера я понял так, что подключать надо вообще другую библиотеку. Под Винды ДОСовскую графику заюзать никак не получится. Тебе же дали ссылку на ОпенГЛ. |
byte |
|
Под Win32 ты не сможешь рисовать в консоли.(по крайней мере я не знаю способов)
#include <windows.h>
Библиотеки обычно подключаются автоматически(Visual Studio’ей). |
trainer |
|
Цитата Ламер, 21.11.04, 15:25 как мы выяснили, будет неправильно. Кто чего выяснил — я не знаю.
#include <conio.h> #include <graphics.h> int main(int,char**) { int max_x, max_y; int driver = DETECT; int mode = 0; initgraph(&driver,&mode,»»); max_x = getmaxx(); max_y = getmaxy(); line(0,0,max_x,max_y,GREEN); putpixel(100,100,RED); while( !kbhit() ); closegraph(); return 0; } |
Мяут |
|
Создай новый проект, там выбири Executable (.EXE), DOS (Standart), в Memory Model — Large, установи голочку BGI. Можно еще написать исходник на C, и за тем скомпилить:
bcc my.c +graphics.lib
|
Ламер |
|
Последний вопрос, самый тупой. |
Мяут |
|
Цитата Ламер, 21.11.04, 18:51 Полез в настройки, а он, оказывается, меньше, чем 800*600 не поддерживает. Не поддерживает XP. А BGI-дрова поддерживают. В случае чего, видюха запускает эмуляцию |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- C/C++: Общие вопросы
- Следующая тема
[ Script execution time: 0,0392 ] [ 16 queries used ] [ Generated: 9.02.23, 12:06 GMT ]
Всем доброго времени суток, помогите пожалуйста, как переделать код чтобы под win скомпилировать?
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<iostream.h>
#include<time.h>
#include<graphics.h>
#include<iomanip.h>
#include<dos.h>
#include<math.h>
#include<complex.h>
#include<string.h>
#define st 30
float t1,t2,t3;
char menu;
SORT(void);
JPEG(void);
RIS(void);
BANCH(void);
void main ()
{
do
{
clrscr();
cout<<» ———————— n»;
cout<<«| |n»;
cout<<«| 1.Sortirovka matricy |n»;
cout<<«| 2.Chtenie massiva JPG. |n»;
cout<<«| 3.Risynok. |n»;
cout<<«| 4.BANCH-TABLICY |n»;
cout<<«| 5.EXIT |n»;
cout<<» ————————nnn»;
cout<<«Viberite PYNKT:»;
menu=getchar();
switch(menu)
{
case’1′:SORT();break;
case’2′:JPEG();break;
case’3′:RIS();break;
case’4′:BANCH();break;
default:;
}
}
while(menu!=’5′);
end:;
}
SORT(void)
{
clrscr();
int a[127][127];
int i,n=120,j,r,m=120,k;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
a[j]=rand()%100;
cout<<«nvvedite:n»;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cout<<setw(4)<<a[j]<<«»;
cout<<«n»;
}
clock_t start, end;
start=clock();
delay(1000);
for(i=0;i<m;i++)
for(j=0;j<(n-1);j++)
for(k=(j+1);k<n;k++)
if(a[j]<a[k])
{
r=a[j];
a[j]=a[k];
a[k]=r;
}
end=clock();
printf(«time=%fn»,(end-start)/CLK_TCK);
t1=(end-start)/CLK_TCK;
cout<<t1;
cout<<«nn»;
getch();
int file_copy( char *oldname, char *newname);
JPEG(void)
{
char sourse[90],destination[90],e[20]
gets(e);
printf(«nEnter sourse file: «)
gets(source);
printf(«Enter destination file: «)
gets(destination);
clock_t start, end;
start=clock;
if (file_copy(source,sestination)==0)
puts(«Copy operation successful»);
else
frintf(stderr,»Error during copy operation»);
cout<<«n»;
end=clock();
printf(«time=%fn»,(end-start)/CLK_TCK);
t2=(end-start)/CLK_TCK;
cout<<t2;
while(!kbhit());
return(0);
}
int file_copy(char *oldname,char *newname)
{
FILE *fold,*fnew;
int c;
if((fold=fopen(oldname,»rb»))==NULL)
return-1;
if((fnew=fopen(newname,»wb»))==NULL)
{
fclose(fold);
return-1;
}
while(1)
{
c=fgetc(fold);
if(!feof(fold))
fputc(c,fnew);
else
break;
}
fclose(fnew);
fclose(fold);
return 0;
}
RIS(void)
{
int gdriver=DETECT,gmode,errorcode;
int l,i,j,n;
initgraph(&gdriver,&gmode, «»);
errorcode=graphresult();
if(errorcode!=grOk)
{
printf(«ERROR:%sn»,grapherrormsg(errorcode));
printf(«press eny key to halt»);
getch();
exit(1);
}
clock_t start,end;
start=clock();
i=270;j=190;
for(l=0;l<140;l++)
{
setcolor(6);
setfillstyle(1,6)
circle(250+l,170,20)l;
moveto(i,j);
lineto(i+100,j);
lineto(i+100,j+100);
lineto(i,j+100);
lineto(i,j);
setfillstyle(1,0);
bar(0,0,1000,1000);
{
for(l=o;l<140;l++)
}
setcolor(6);
setfillstyle(1,6);
circle(390,170+l,20);
moveto(i,j);
lineto(i+100,j);
lineto(i+100,j+100);
lineto(i,j+100);
lineto(i,j);
setfillstyle(1,0);
bar(0,0,1000,1000);
{
for(l=0;l<140;l++)
}
setcolor(6);
setfillstyle(1,6);
circle(390-l,310,20);
moveto(i,j);
lineto(i+100,j);
lineto(i+100,j+100);
lineto(i,j+100);
lineto(i,j);
setfillstyle(1,0);
bar(0,0,1000,1000);
{
for(l=0;l<140;l++)
}
setcolor(6);
setfillstyle(1,6);
circle(250,310-l,20);
moveto(i,j);
lineto(i+100,j);
lineto(i+100,j+100);
lineto(i,j+100);
lineto(i,j);
setfillstyle(1,0);
bar(0,0,1000,1000);
}
closegraph();
cout<<«n»;
end=clock();
printf(«time=%fn»,(end-start)/CLK_TCK);
t3=(end-start)/CLK_TCK;
cout<<t3;
getch();
return 0;
}
BANCHH(void)
{
float sum1,sa1;
float k=0.333333333;
float const1=1.04,const2=0.76,const3=0.97,sa2=0.91;
float const11=0.98,const22=0.87,const33=1.03,sa3=0.96;
sum1=t1*t2*t3;
sa1=pow(sum,k1);
printf(«BANCH-MARK KARTA (FORMA 1)n»);
printf(«||==========||==========||===========||===========||===========||n»);
printf(» Cout Syst. TEST1 TEST2 TEST3 | n»);
cout<<» CS1 «<<t1<<» «<<t2<<» «<<t3<<» «<<sa1<<«n»;
cout<<» CS2 «<<const1<<» «<<const2<<» «<<const3<<» «<<sa2<<«n»;
cout<<» CS3 «<<const11<<» «<<const22<<» «<<const33<<» «<<sa3<<«n»;
printf(«nnn»);
float a1,a2,a3,a4,a5,a6,a7,a8,a9;
float sa11,sa22,sa33,b,c;
a7=t1/t1;
a8=t2/t2;
a9=t3/t3;
a1=const1/t1;
a2=const2/t2;
a3=const3/t3;
a4=const11/t1;
a5=const22/t2;
a6=const33/t3;
sa33=sa3/sa3;
b=a1*a2*a3;
sa22=pow(b,k);
c=a4*a5*a6;
sa33=pow(c,k);
printf(«BANCH-MARK KARTA (FORMA 2)n»);
printf(«||==========||==========||==========||==========||==========||n»);
printf(«Cout Syst. TEST1 TEST2 TEST3 | n» );
cout<<» CS1 «<<a1<<» «<<a2<<» «<<a3<<» «<<sa11<<«n»;
cout<<» CS2 «<<a4<<» «<<a5<<» «<<a6<<» «<<sa22<<«n»;
cout<<» CS3 «<<a7<<» «<<a8<<» «<<a9<<» «<<sa33<<«n»;
while(!kbhit());
return 0;
}
; }}
hi!
i tried to run the following program in BORLAND C++ version 5.02..
#include<stdio.h>
#include<graphics.h>
#include<string.h>
#include<math.h>
#include<conio.h>
int const monthcount=12,dataoffset=18;
struct indata
{
float realarray[ 12];
float array[ 12];
};
char getlabel[3];
indata data;
int monthplace[ 12];
float interval,chartbottom,radius;
struct wcp
{
float x;
float y;
} coord[monthcount];
wcp center;
int round(float a)
{
int b;
b=a;
if(a-b>0.5)
return ++b;
else
return b;
}
void polyline(int x, wcp *y)
{
for(int i=0;i<x-1 ;i++)
line(y[i].x,y[i].y,y[i+1].x,y[i+1].y);
}
void getlab(int x)
{
switch(x)
{
case 0:
{
strcpy(getlabel,"JAN");
break;
}
case 1:
{
strcpy(getlabel ,"FEB");
break;
}
case 2:
{
strcpy(getlabel," MAR");
break;
}
case 3:
{
strcpy(getlabel,"APR");
break;
}
case 4:
{
strcpy(getlabel,"MAY");
break;
}
case 5:
{
strcpy(getlabel,"JUN");
break;
}
case 6:
{
strcpy(getlabel,"JUL");
break;
}
case 7:
{
strcpy(getlabel,"AUG" );
break;
}
case 8:
{
strcpy(getlabel,"SEP");
break;
}
case 9:
{
strcpy(getlabel,"OCT");
break;
}
case 10:
{
strcpy(getlabel,"NOV");
break;
}
case 11:
{
strcpy(getlabel,"DEC");
break;
}
}
}
void getdata()
{
float t1=0.00,t2;
for(int t=0;t<12;t++)
{
getlab(t);
printf("ENTER THE DATA FOR THE MONTH OF %s: ",getlabel);
scanf("%f",&data.realarray[t]);
if(data.realarray[t]>t1 )
{
t1=data.realarray[t];
}
}
for(t=0;t<12;t++)
{
t2=data.realarray[t]/t1;
data.array[t]=t2*400;
}
}
void puttext(wcp textp)
{
settextstyle(1,HORIZ_DIR,1);
outtextxy(textp.x,textp.y,getlabel);
}
void drawlabels()
{
wcp textposition;
textposition.y=chartbottom;
int zz=25;
for(int az=0;az<12;az++)
{
textposition.x=zz;
zz+=50;
getlab(az);
puttext(textposition);
}
}
char valuep[5];
void findvaluep(int x)
{
int y=x,ttt;
char tg[5];
strcpy(tg,"");
do
{
ttt=y%10;
switch(ttt)
{
case 0:
{
strcat(tg,"0");
break;
}
case 1:
{
strcat(tg,"1");
break;
}
case 2:
{
strcat(tg,"2");
break;
}
case 3:
{
strcat(tg,"3");
break;
}
case 4:
{
strcat(tg,"4");
break;
}
case 5:
{
strcat(tg,"5");
break;
}
case 6:
{
strcat(tg,"6");
break;
}
case 7:
{
strcat(tg,"7");
break;
}
case 8:
{
strcat(tg,"8");
break;
}
case 9:
{
strcat(tg,"9");
break;
}
}
y/=10;
} while(y>0);
strcpy(valuep,"");
for(y=0;y<strlen(tg);y++)
{
valuep[y]=tg[strlen(tg)-y-1];
}
valuep[y]=NULL;
}
void linechart()
{
drawlabels();
settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
for(int t=0;t<monthcount;t++)
{
coord[t].x=monthplace[t];
coord[t].y=450-data.array[t]-dataoffset;
findvaluep(data.realarray[t]);
outtextxy(coord[t].x,coord[t].y-10,valuep);
}
polyline(monthcount,coord);
}
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"");
getdata();
cleardevice();
chartbottom=450.0;
interval=50.0;
monthplace[0]=25;
for(int z=1;z<monthcount;z++)
monthplace[z]=monthplace[z-1 ]+interval;
linechart();
getch();
cleardevice();
closegraph();
}
but it tells me that BGI graphics is not supported under windows..
what does this mean????????
i tried googling it, but couldn’t understand how to solve it, all i came to know is that there is some other header file to be used..
now what should i do?.. if i am to change the header file, then where to get the new header file from? and how to use this??
i am new to graphics programming in Borland c++, so i am not able to understand much… hence, if possible plz give me the exact procedure to follow..
plz help me out..
Форум программистов Vingrad
Модераторы: bsa |
Поиск: |
|
ОШИБКА «error BGI graphics …. « |
Опции темы |
Panterka |
|
||
Новичок Профиль Репутация: нет
|
Сделала программу по созданию графика, при попытке проверки выдаёт ошибку:» error BGI graphics not supported under Windows» как её можно исправить? |
||
|
|||
Andrey44 |
|
||
Эксперт Профиль
Репутация: 2
|
Panterka, покажи код где получается ошибка. ——————— ????? ??, ??????? ?????. |
||
|
|||
volvo877 |
|
||
Эксперт Профиль Репутация: нет
|
Panterka, у тебя Borland C++ 4 или 5? Какое приложение ты создала? Нужно DOS Application, чтобы BGI-графика работала… |
||
|
|||
Panterka |
|
||
Новичок Профиль Репутация: нет
|
вот программа:
|
||
|
|||
volvo877 |
|
||
Эксперт Профиль Репутация: нет
|
Ты на мои вопросы (о компиляторе) принципиально не отвечаешь? Тогда могу сказать одно:
(синтаксические ошибки исправлены) Turbo C++ 3.0 — компилируется и отрабатывает без проблем… Меняй компилятор, раз у тебя не работает… |
||
|
|||
Panterka |
|
||
Новичок Профиль Репутация: нет
|
Просто занята была, у меня Borland C++ 5.02 |
||
|
|||
Panterka |
|
||
Новичок Профиль Репутация: нет
|
Поменять не могу, так как необходимо было создать приложение именно в С++ 5.02. А ошибку он так и выдаёт:»error BGI graphics not supported under Windows». Может быть что-то в настройках самой программы нужно поменять? Это сообщение отредактировал(а) Panterka — 11.12.2007, 10:12 |
||
|
|||
bsa |
|
||
Эксперт Профиль
Репутация: 85
|
Panterka, да. зайди в настройки Target и выбери DOS application (memory model Large). ——————— Правильно заданный вопрос — половина ответа |
||
|
|||
Panterka |
|
||
Новичок Профиль Репутация: нет
|
Всем спасибо за помощь, ошибку исправила. |
||
|
|||
|
Правила форума «C/C++: Для новичков» | |
|
Запрещается! 1. Публиковать ссылки на вскрытые компоненты 2. Обсуждать взлом компонентов и делиться вскрытыми компонентами
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, JackYF, bsa. |
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) |
0 Пользователей: |
« Предыдущая тема | C/C++: Для новичков | Следующая тема » |