I trying compile my program but it all time write error: stray '\32 ' in program , I have there some graphics instruction, I think its error with directx but Im not surre. If somebody want i can send him my source.
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
Please post the code and line number where the error occurs. I left my crystal ball at home and so I can't see what causes this error
hezechiel 0 Newbie Poster
hmm so how u want :) but i dont know if its help u :)
error is at last line , there where u see square after }
this program work on Turbo C with small changes like clrscr, etc.
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
#include<dxfile.h>
int x,y,all,hall,grove,a,a0,b,love,i,ban,year,rud,rab,lud,crud,nahoda,p,p2,cban,katap,k,prevaha;
int j,x1,voj,orks,tazban,pludban,menu,visdan,dan,submenu,ncr,ncb,ludvoj,pridel;
int gd=DETECT,gm,poloha,mapmenu,xmap,ymap,xarmy,yarmy,xarmy0,yarmy0,posol,rposol;
int xorks,yorks,win;
float slud,obrvoj,obrorks,utvoj,utorks,orksp;
void hlavnemenu(void)
{
settextstyle(4,0,5);
if(submenu==1)
{
setcolor(RED);
outtextxy(175,180,"ZACAT HRU");
}
else
{
setcolor(WHITE);
outtextxy(175,180,"ZACAT HRU");
}
if(submenu==2)
{
setcolor(RED);
outtextxy(220,230,"AUTOR");
}
else
{
setcolor(WHITE);
outtextxy(220,230,"AUTOR");
}
if(submenu==3)
{
setcolor(RED);
outtextxy(210,280,"KONIEC");
}
else
{
setcolor(WHITE);
outtextxy(210,280,"KONIEC");
}
}
void hramenu(void)
{
settextstyle(1,0,4);
if(submenu==0)
{
setcolor(BLUE);
outtextxy(90,220,"Koniec");
outtextxy(100,250,"tahu");
}
else
{
setcolor(WHITE);
outtextxy(90,220,"Koniec");
outtextxy(100,250,"tahu");
}
if(submenu==1)
{
setcolor(BLUE);
outtextxy(100,300,"Mapa");
}
else
{
setcolor(WHITE);
outtextxy(100,300,"Mapa");
}
if(submenu==2)
{
setcolor(BLUE);
outtextxy(280,210,"Nakup");
}
else
{
setcolor(WHITE);
outtextxy(280,210,"Nakup");
}
if(submenu==3)
{
setcolor(BLUE);
outtextxy(280,240,"Predaj");
}
else
{
setcolor(WHITE);
outtextxy(280,240,"Predaj");
}
if(submenu==4)
{
setcolor(BLUE);
outtextxy(290,270,"Jedlo");
if(pridel>0)
outtextxy(370,270,"*");
if(pridel>2*ludvoj)
outtextxy(380,270,"*");
}
else
{
setcolor(WHITE);
outtextxy(290,270,"Jedlo");
if(pridel>0)
outtextxy(370,270,"*");
if(pridel>2*ludvoj)
outtextxy(380,270,"*");
}
if(submenu==5)
{
setcolor(BLUE);
outtextxy(300,300,"Dane");
}
else
{
setcolor(WHITE);
outtextxy(300,300,"Dane");
}
if(submenu==6)
{
setcolor(BLUE);
outtextxy(280,330,"Vojsko");
}
else
{
setcolor(WHITE);
outtextxy(280,330,"Vojsko");
}
if(submenu==7)
{
setcolor(BLUE);
outtextxy(450,240,"Hlavne");
outtextxy(460,270,"menu");
}
else
{
setcolor(WHITE);
outtextxy(450,240,"Hlavne");
outtextxy(460,270,"menu");;
}
}
void bitkamenu(void)
{
settextstyle(1,0,4);
if(submenu==1)
{
setcolor(RED);
outtextxy(285,300,"Utok");
}
else
{
setcolor(WHITE);
outtextxy(285,300,"Utok");
}
if(submenu==2)
{
setcolor(RED);
outtextxy(250,340,"Katapulty");
}
else
{
setcolor(WHITE);
outtextxy(250,340,"Katapulty");
}
if(submenu==3)
{
setcolor(RED);
outtextxy(270,380,"Zoradit");
outtextxy(290,420,"siky");
}
else
{
setcolor(WHITE);
outtextxy(270,380,"Zoradit");
outtextxy(290,420,"siky");
}
if(submenu==4)
{
setcolor(RED);
outtextxy(50,340,"Ustup");
}
else
{
setcolor(WHITE);
outtextxy(50,340,"Ustup");
}
}
void danemenu(void)
{
setcolor(WHITE);
settextstyle(1,0,3);
outtextxy(120,100,"Ake dane sa budu platit v kraji?");
settextstyle(1,0,5);
if(visdan>=1)
{
setcolor(BLUE);
outtextxy(100,250,"1");
}
else
{
setcolor(WHITE);
outtextxy(100,250,"1");
}
if(visdan>=2)
{
setcolor(BLUE);
outtextxy(140,250,"2");
}
else
{
setcolor(WHITE);
outtextxy(140,250,"2");
}
if(visdan>=3)
{
setcolor(BLUE);
outtextxy(180,250,"3");
}
else
{
setcolor(WHITE);
outtextxy(180,250,"3");
}
if(visdan>=4)
{
setcolor(BLUE);
outtextxy(220,250,"4");
}
else
{
setcolor(WHITE);
outtextxy(220,250,"4");
}
if(visdan>=5)
{
setcolor(BLUE);
outtextxy(260,250,"5");
}
else
{
setcolor(WHITE);
outtextxy(260,250,"5");
}
if(visdan>=6)
{
setcolor(BLUE);
outtextxy(300,250,"6");
}
else
{
setcolor(WHITE);
outtextxy(300,250,"6");
}
if(visdan>=7)
{
setcolor(BLUE);
outtextxy(340,250,"7");
}
else
{
setcolor(WHITE);
outtextxy(340,250,"7");
}
if(visdan>=8)
{
setcolor(BLUE);
outtextxy(380,250,"8");
}
else
{
setcolor(WHITE);
outtextxy(380,250,"8");
}
if(visdan>=9)
{
setcolor(BLUE);
outtextxy(420,250,"9");
}
else
{
setcolor(WHITE);
outtextxy(420,250,"9");
}
if(visdan>=10)
{
setcolor(BLUE);
outtextxy(460,250,"10");
}
else
{
setcolor(WHITE);
outtextxy(460,250,"10");
}
if(submenu==11)
{
setcolor(RED);
outtextxy(150,200,"Nemenit dane");
}
else
{
setcolor(WHITE);
outtextxy(150,200,"Nemenit dane");
}
}
void army(void)
{
setfillstyle(1,LIGHTGRAY);
setcolor(LIGHTGRAY);
bar(xarmy+5,yarmy+10,xarmy+35,yarmy+40);
fillellipse(xarmy+20,yarmy+40,15,10);
setcolor(WHITE);
setfillstyle(1,WHITE);
fillellipse(xarmy+20,yarmy+25,8,8);
}
void rarmy(void)
{
setfillstyle(1,GREEN);
setcolor(GREEN);
bar(xarmy+5,yarmy+10,xarmy+35,yarmy+40);
fillellipse(xarmy+20,yarmy+40,15,10);
setcolor(GREEN);
setfillstyle(1,WHITE);
fillellipse(xarmy+20,yarmy+25,8,8);
}
void orkarmy(void)
{
setfillstyle(1,BROWN);
setcolor(BROWN);
fillellipse(xorks+25,yorks+25,20,20);
}
void rorkarmy(void)
{
setfillstyle(1,GREEN);
setcolor(15);
fillellipse(xorks+25,yorks+25,20,20);
}
void mapa(void)
{
setfillstyle(1,GREEN);
bar(100,250,500,450);
/*line(100,300,500,300);
line(100,350,500,350);
line(100,400,500,400);
line(150,250,150,450);
line(200,250,200,450);
line(250,250,250,450);
line(300,250,300,450);
line(350,250,350,450);
line(400,250,400,450);
line(450,250,450,450);*/
}
void hrad(void)
{
setfillstyle(1,LIGHTGRAY);
setcolor(LIGHTGRAY);
bar(100,355,145,360);
bar(100,395,145,400);
bar(105,350,110,360);
bar(115,350,120,360);
bar(125,350,130,360);
bar(135,350,140,360);
bar(145,350,150,400);
bar(105,390,110,400);
bar(115,390,120,400);
bar(125,390,130,400);
bar(135,390,140,400);
bar(100,368,120,387);
bar(100,363,107,368);
bar(113,363,120,368);
setfillstyle(1,BROWN);
bar(145,365,150,375);
setfillstyle(1,8);
bar(120,377,145,383);
setcolor(0);
line(107,370,107,376);
line(113,370,113,376);
line(110,370,110,376);
line(107,373,113,373);
line(145,370,150,370);
}
void tabor(void)
{
setfillstyle(1,BROWN);
bar(455,345,500,350);
bar(455,305,500,310);
bar(450,310,455,350);
bar(480,318,500,337);
setfillstyle(1,LIGHTGREEN);
bar(455,328,480,333);
setfillstyle(1,0);
bar(450,315,455,325);
setcolor(0);
line(487,328,492,328);
line(487,328,487,337);
line(492,328,492,337);
setcolor(BROWN);
line(480,313,480,318);
line(484,313,484,318);
line(488,313,488,318);
line(492,313,492,318);
line(496,313,496,318);
line(500,313,500,318);
line(450,307,450,310);
line(452,304,452,310);
line(454,303,454,310);
line(455,300,455,310);
line(459,300,459,310);
line(463,300,463,310);
line(467,300,467,310);
line(471,300,471,310);
line(475,300,475,310);
line(479,300,479,310);
line(483,300,483,310);
line(487,300,487,310);
line(491,300,491,310);
line(495,300,495,310);
line(499,300,499,310);
line(459,340,459,350);
line(463,340,463,350);
line(467,340,467,350);
line(471,340,471,350);
line(475,340,475,350);
line(479,340,479,350);
line(483,340,483,350);
line(487,340,487,350);
line(491,340,491,350);
line(495,340,495,350);
line(499,340,499,350);
line(455,300,455,310);
}
void kurzor(void)
{
setcolor(GREEN);
rectangle(xmap,ymap,xmap+50,ymap+50);
}
void nkurzor(void)
{
setcolor(YELLOW);
rectangle(xmap,ymap,xmap+50,ymap+50);
}
void hranamape(void)
{
mapmenu='1';
nkurzor();
while(mapmenu!='5')
{
mapmenu=getch();
switch(mapmenu)
{
case '8':if(poloha>8)
{
poloha=poloha-8;
kurzor();
ymap=ymap-50;
nkurzor();
}
break;
case '2':if(poloha<25)
{
poloha=poloha+8;
kurzor();
ymap=ymap+50;
nkurzor();
}
break;
case '6':if(poloha!=8 && poloha!=16 && poloha!=24 && poloha!=32)
{
poloha=poloha+1;
kurzor();
xmap=xmap+50;
nkurzor();
}
break;
case '4':if(poloha!=1 && poloha!=9 && poloha!=17 && poloha!=25)
{
poloha=poloha-1;
kurzor();
xmap=xmap-50;
nkurzor();
}
break;
default:;
}
}
}
void svet(void)
{
a0=a;
xarmy0=xarmy;
yarmy0=yarmy;
if(poloha==a)
{
if(posol==0)
{
mapmenu='1';
nkurzor();
while(mapmenu!='5')
{
mapmenu=getch();
kurzor();
rarmy();
switch(mapmenu)
{
case '8':if(i<2)
{
if(a>8)
{
a=a-8;
kurzor();
yarmy=yarmy-50;
nkurzor();
}
}
nkurzor();
break;
case '2':if(i<2)
{
if(a<25)
{
a=a+8;
kurzor();
yarmy=yarmy+50;
nkurzor();
}
}
nkurzor();
break;
case '6':if(i<2)
{
if(a!=8 && a!=16 && a!=26 && a!=32)
{
a=a+1;
kurzor();
xarmy=xarmy+50;
nkurzor();
}
}
nkurzor();
break;
case '4':if(i<2)
{
if(a!=1 && a!=9 && a!=17 && a!=25)
{
Edited by peter_budo because: Code moved to attachment file
VernonDozier 2,218 Posting Expert Featured Poster
I don't think that's what niek meant. The compiler gave you a line number with the error, yes? Post that line of code, plus whatever other lines you think may be needed to give you help. Use C++ style code tags
[code=cplusplus] // paste code here
[/code]
so that line numbers are generated, give the exact error, along with the relevant line number of the code you posted, and anything else that may be helpful. No one is going to sift through that much code.
hezechiel 0 Newbie Poster
Ok eror is in last line: "}" nothink more is there itsend of program and source...
here is link to download..try complile :).
http://www.upnito.sk/download.php?dwToken=2acc2f42878c625c12dcdd68647f3403
Cybulski 5 Light Poster
All I can tell on this subject is: compilator do not detect problems or errors with directx, only withyour C++ syntax.
Try get Dev C++ help on that error. Errors often are indicated at end of file, but they can occur anywhere. It is good to use 2 compilers so you can compare compiler output. I use MS Visual Studio 2008 and it works very well so far. Free download from MSDN.
hezechiel 0 Newbie Poster
so thanks :) i will try it
praveensahu 0 Newbie Poster
so thanks :) i will try it
i am geting error: stray ‘/32’ in program i dont why please help me in compiling
dotancohen 0 Junior Poster in Training
I just experienced this error. It turns out that there were strange possibly nonprinting unicode characters in the source code, that happened by accidentally switching keyboard layouts in the middle of typing the source and not properly deleting the characters. Deleting the entire line in question and the one before it, then retyping the code, solved the issue.
I hope this helps someone, it seems far too late for the OP. In any case, it took myself a good hour to diagnose this just now.
nmepntgrm 0 Newbie Poster
dotancohen is right, I expirienced this error, the errors occur when i tried to copy a bunch of code out of pdf file, so rewrite, do not copy
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.