C++ Graphics Problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 2
Reputation: butt_usman is an unknown quantity at this point 
Solved Threads: 0
butt_usman butt_usman is offline Offline
Newbie Poster

C++ Graphics Problem

 
0
  #1
Jun 29th, 2008
Hello! All

Well its a problem i have no idea about it ...

check dis :

i created a small graphics program.. like which draw a circle on screen..

it works very fine..

on other hand when i shift that code into my bigger program where i have used structers and filehandling .. i simply put that graphics code in a function and call it in main ... It Gives error..

BGI Error : Graphics not initialised (use 'initgraph')


but everything is fine..... do any one why it happens???

cuz even in that error program if i remove all other code specially structures... graphics works (

Please help...

One more thing .. On one of my PC which has high power components... Like 7900GTX .. graphics Dont work on C++ :O

Thanks !
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,445
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C++ Graphics Problem

 
0
  #2
Jun 29th, 2008
Are you using the Borland graphics from graphics.h in Turbo C or Turbo C++ ? Yes, then I'm not supprised it doesn't work with modern high-powered graphics cards. Afterall, Turbo C is something like 20+ years old.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: butt_usman is an unknown quantity at this point 
Solved Threads: 0
butt_usman butt_usman is offline Offline
Newbie Poster

Re: C++ Graphics Problem

 
0
  #3
Jul 6th, 2008
Thanks, i admit that c is very old but what about my problem where graphics works and just not work in my partiular program..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,445
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C++ Graphics Problem

 
0
  #4
Jul 6th, 2008
my complete guess is that the program has run out of memory.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: C++ Graphics Problem

 
0
  #5
Jul 6th, 2008
It would be easier for others to find the problem if you post your code or else people will be forced to guess like Ancient Dragon
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: C++ Graphics Problem

 
2
  #6
Jul 6th, 2008
> One more thing .. On one of my PC which has high power components... Like 7900GTX ..
Buy Ferrari.
Take out engine.
Replace engine with a horse.

Your compiler is the horse!

In one fell swoop, you've reduced your uber machine to an 8086 (and not the pentium-iv it has) with 640K of RAM (not the GB it has), and a VGA display with limited resolution and colours (and nothing like the graphics card you have).

Not to mention
- short filenames
- no knowledge of NTFS
- probable Y2K issues (gosh, really, that was like 10 years ago man)

Also (if that's not enough to convince you), dumb stuff like
char *buff; gets(buff);
usually works on DOS (for a while at least), whereas with any decent OS/Compiler, you get your ass handed back to you on a plate because it's such crap code.

For compilers
http://www.thefreecountry.com/compilers/cpp.shtml
http://www.compilers.net/
http://www.codeblocks.org/home
The latest visual studio express from Microsoft (+ the platform SDK), or code::blocks seem good choices.

And for graphics
http://www.libsdl.org/
SDL is a wrapped up version (simpler) than OpenGL (which you could also use).
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: C++ Graphics Problem

 
0
  #7
Jul 6th, 2008
Thank you Salem You have fed me enough knowledge to convince my friends why not to use Turbo C.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 464
Reputation: invisal is a jewel in the rough invisal is a jewel in the rough invisal is a jewel in the rough 
Solved Threads: 49
invisal's Avatar
invisal invisal is offline Offline
Posting Pro in Training

Re: C++ Graphics Problem

 
0
  #8
Jul 6th, 2008
Originally Posted by Prabakar View Post
Thank you Salem You have fed me enough knowledge to convince my friends why not to use Turbo C.
I was once trying to convince my teacher to convince my university to change the compiler; yet they still won't change it. Sadly, I have to learn with that old compiler.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 334
Reputation: Prabakar is on a distinguished road 
Solved Threads: 29
Prabakar's Avatar
Prabakar Prabakar is offline Offline
Posting Whiz

Re: C++ Graphics Problem

 
0
  #9
Jul 6th, 2008
Well, All I want is to change my friends. At least that should be possible
I was not able to convince my teacher
When I said that, The answer I got was this "Visual C++ should not be used, Its a different language. You should use C++" I should say Turbo c++ == C++ in my world!

Glad though that the trend is changing.
In many institutions turbo c is replaced by gnu compilers. As to me Daniweb is the only source of light.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: C++ Graphics Problem

 
0
  #10
Jul 6th, 2008
> "Visual C++ should not be used, Its a different language.
Yes, and so is "Turbo C++" as well.
Either is brain-damage if the tutor gets too "comfortable" with a particular compiler. The tutor is already on shaky ground if they can't tell the difference between a language and an implementation.

If the tutor was actually any good, they'd suggest a set of compilers and ask the students to choose one. Any decent course in "standard C++" simply wouldn't care about which compiler you used, they should all be the same.

Getting code to work on your favourite compiler is no great feat. Writing portable code which works across a range of operating systems and compilers takes it to the next level.

The real problem is a lot of tutors have learnt "dialect C++" and they're just too lazy (or shamed) to fix the problem by learning standard C++. So they trot out the same old lines about how hard it is to upgrade to something more modern.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC