Run graphics command in Dev-cpp

I'm using Dev-cpp .Inorder to run graphics command in dev-cpp I included graphics package and bgi files in dev-cpp.But still I'm not able to run graphics command as it throws errors.

Replies

  • Nayan Goenka
    Nayan Goenka
    There are many reasons as to why the graphics command might not be working. did you include graphics.h in your code. Also can you post which errors you get so that we get a better picture.
  • Shailaja Tiwari
    Shailaja Tiwari
    here's my code :


    Untitled
  • Nayan Goenka
    Nayan Goenka
    This error seems to be generated due to bad header file. You can try by doing one change here. Change int main() to void main() and remove the return line. I hope this one works. If not, then the header file isnot meant for devcpp. You can try turbocpp
  • Shailaja Tiwari
    Shailaja Tiwari
    Nayan Goenka
    Change int main() to void main() and remove the return line.
    I tried it before but it again generates an error as "iostream.h header file not found".So this option doesn't work.
    You can try turbocpp
    no chance I've already given up with that compiler .πŸ˜‘πŸ‘Ž
    Isn't there anything else that can be done.I've tried googling but seems of no help.
    whereas the earlier header file that I had downloaded throws an error as sstream header file not found .πŸ˜”
  • Vishal Sharma
    Vishal Sharma
    shailaja revathi
    I tried it before but it again generates an error as "iostream.h header file not found".So this option doesn't work.

    no chance I've already given up with that compiler .πŸ˜‘πŸ‘Ž
    Isn't there anything else that can be done.I've tried googling but seems of no help.
    whereas the earlier header file that I had downloaded throws an error as sstream header file not found .πŸ˜”
    I don't think dev supports graphics.h
    however try Downloading the BGI library and try linking with your project.. that might give you some help!
  • Shailaja Tiwari
    Shailaja Tiwari
    Vishal0203
    I don't think dev supports graphics.h
    however try Downloading the BGI library and try linking with your project.. that might give you some help!
    I've already done that .
  • Nayan Goenka
    Nayan Goenka
    Well it seems all the issues you are facing is basically due to the compiler fault. There is nothing you can do to fix it.

    There is a error i just noticed in your code. As i said use the void main()

    And correct the first line to.
    #include

    The .h seems missing. Maybe it can resolve. If it still doesn't work then you know the answer already, Change compiler, try some other one.
  • Shailaja Tiwari
    Shailaja Tiwari
    Nayan Goenka
    Well it seems all the issues you are facing is basically due to the compiler fault. There is nothing you can do to fix it.

    There is a error i just noticed in your code. As i said use the void main()

    And correct the first line to.
    #include
    Actually dev-cpp doesn't allow the use of .It throws an error on using it as 'iostream.h' header file not found .And hence I cannot use void main() as it's not a good programming practice and also not supproted in dev-cpp and most standard versions(I'm using dev-cpp version 5.4.1).
    And I'm googling for another compiler meant for graphics functions but you know it's difficult to decide which one would be best ,I'm mean I don't want some outdated old versions ,I wanna try new softwares .Well what is Cygwin ,I mean I know that it provides linux like environnemnt on windows system but is it efficient to be used and please do recommend if you know of some other compiler for Windows 7 32-bit .
  • Vishal Sharma
    Vishal Sharma
    shailaja revathi
    Actually dev-cpp doesn't allow the use of .It throws an error on using it as 'iostream.h' header file not found .And hence I cannot use void main() as it's not a good programming practice and also not supproted in dev-cpp and most standard versions(I'm using dev-cpp version 5.4.1).
    And I'm googling for another compiler meant for graphics functions but you know it's difficult to decide which one would be best ,I'm mean I don't want some outdated old versions ,I wanna try new softwares .Well what is Cygwin ,I mean I know that it provides linux like environnemnt on windows system but is it efficient to be used and please do recommend if you know of some other compiler for Windows 7 32-bit .
    there is no relation between iostream header and error in declaration of main().
    Dev c++ take cares that you don't follow the wrong standards and hence it doesn't allow you to use void main() as it is a bad practice! Use int main() instead! there are reasons behind these things.
  • Nayan Goenka
    Nayan Goenka
    Well if you are asking me for a good compiler I would still suggest Turbo C++ which comes in DosBox. It is what I use myself. But I am not a hard core C programmer so it doesn't matter to me directly. I didn't do graphics in C so I dont know much of this. You seem more into C. Good luck in finding a good compiler. What are you trying to build with graphics btw? is it only some testing and exploring or some serious development you are doing.
  • rahul69
    rahul69
    shailaja revathi
    I'm using Dev-cpp .Inorder to run graphics command in dev-cpp I included graphics package and bgi files in dev-cpp.But still I'm not able to run graphics command as it throws errors.
    Hi thereπŸ˜€! good to know u are not using turbo C compiler, but then why are u using old bgi library? I would recommend u to use Opengl in DevCpp.
    Or if u want to simply use windows and stuff, without drawing lines and rectangles stuff, u can try ur hands on Windows Programming, (It would be a little difficult but adventurous πŸ˜‰).
    Finally if u still direly wanna do using bgi here is a link I found <#-Link-Snipped-#> hope it helps.
    If u want to try another compiler, u can try Visual C++ , its a bit heavier but worth's a shot.
    Good Luck Programming!πŸ‘
  • Shailaja Tiwari
    Shailaja Tiwari
    Vishal0203
    there is no relation between iostream header and error in declaration of main().
    Dev c++ take cares that you don't follow the wrong standards and hence it doesn't allow you to use void main() as it is a bad practice! Use int main() instead! there are reasons behind these things.
    Actually in Dev-cpp :
    #include
    using namespace std;
    So use of main() with return type of int is supported instead of void and hence there is probably a relation with iostream header and main()'s retrun type.
    This is what I meant and I'm used to using int main() atleast at home.
    Anyway all this stuff I'd learnt from your previous posts in regard to c++ programming tutorials and inspired by that I'm prefering this awesome compiler dev-cpp(atleast better than turbo c).πŸ˜›
  • Shailaja Tiwari
    Shailaja Tiwari
    Nayan Goenka
    You seem more into C. Good luck in finding a good compiler. What are you trying to build with graphics btw?
    Actually we have computer graphics practical in c and I don't get enough to learn from turbo-c dos-box in colg due to limited time .Previously I had been using dos-box but it didn't have full screen view and behaved erratically and it seemed a bit tedious to handle it.
    [/is it only some testing and exploring or some serious development you are doing.QUOTE]
    Only testing and some explorations.
    no ,only testing and exploring .No opportunity, and time as well, to do some serious development.
  • Shailaja Tiwari
    Shailaja Tiwari
    rahul69
    Hi thereπŸ˜€! good to know u are not using turbo C compiler, but then why are u using old bgi library? I would recommend u to use Opengl in DevCpp.
    Or if u want to simply use windows and stuff, without drawing lines and rectangles stuff, u can try ur hands on Windows Programming, (It would be a little difficult but adventurous πŸ˜‰).
    Finally if u still direly wanna do using bgi here is a link I found <#-Link-Snipped-#> hope it helps.
    If u want to try another compiler, u can try Visual C++ , its a bit heavier but worth's a shot.
    Good Luck Programming!πŸ‘
    Thanks for the link it solved some of my problems regarding sstream error.
    Will try others also.πŸ˜€
  • Vishal Sharma
    Vishal Sharma
    shailaja revathi
    Thanks for the link it solved some of my problems regarding sstream error.
    Will try others also.πŸ˜€
    I researched on a few things. I think you should go with Code Blocks EP version which has winbgim inbuilt in it...
    I tested the code what you have written above!
    works fine!
  • Vishal Sharma
    Vishal Sharma
    A copied program!!
    executed in code blocks EP
    gives the output as the attached image! πŸ˜€
              #include 
              #include 
    
              int gdriver = DETECT;
              int gmode;
    
              main()
              {
                  struct fillsettingstype saveset;
                  int pat, clr;
    
                  initgraph(&gdriver,&gmode,"");
                  for (pat = 1; pat < 12; pat++)  {
                      for (clr = 1; clr <16; clr++) {
                          setfillstyle(pat,clr);
                          pieslice(100,100,0,134,49);
                          getch();
                      }
                  }
                  closegraph();
              }
    
    
    
    Untitled
  • Shailaja Tiwari
    Shailaja Tiwari
    Vishal0203
    I researched on a few things. I think you should go with Code Blocks EP version which has winbgim inbuilt in it...
    I tested the code what you have written above!
    works fine!
    Thanks downloading it now.Will try this too.
  • rahul69
    rahul69
    shailaja revathi
    Actually we have computer graphics practical in c and I don't get enough to learn from turbo-c dos-box in colg due to limited time .Previously I had been using dos-box but it didn't have full screen view and behaved erratically and it seemed a bit tedious to handle it.
    If that's the case , here is an awesome solution to ur problem:
    #-Link-Snipped-#
    Good Luck! πŸ˜€
  • Shailaja Tiwari
    Shailaja Tiwari
    rahul69
    If that's the case , here is an awesome solution to ur problem:
    #-Link-Snipped-#
    Good Luck! πŸ˜€
    Is it a freeware?
    Well I downloaded the software and works the same way as in college,i.e. fullscreen viewing .
    Thanks.πŸ˜€πŸ˜

You are reading an archived discussion.

Related Posts

Its the latest trend in interview circle-Psychological tests. I had been to a interview recently. Interviewer says u will get a post of ASST Manager for your experience of 10...
Skype - the company now owned by Microsoft, has confirmed that their engineers are working on developing 3D video call facility. One of the senior executives of Skype unveiled the...
Recently IRCTC have stepped themselves in online shopping known as "SHOP.IRCTC" by, Extends their hand for shopping while booking tickets now people won't say the website is slow while in...
I'm wondering if there's any reason not to buy the Kindle Paperwhite. The price point, Rs. 10,999 looks attractive and the devices comes with wireless, paperwhite display, better resolution than...
Every entrepreneur in the world has to face criticism - at the idea stage, at the 'startup' stage and even when the startup grows into a successful business. The thing...