Executing c graphics programs in Terminal

the following prgm has been written in the vi editor...it has been named hello.cpp

#include<iostream>
#include<graphics>
int main(void)
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
line(0, 0, 100, 100);
closegraph();
}

the errors are as follows:

g++ hello.cpp -o hello

hello.cpp:2:19: error: graphics: No such file or directory
hello.cpp: In function 'int main()':
hello.cpp:5: error: 'DETECT' was not declared in this scope
hello.cpp:6: error: 'initgraph' was not declared in this scope
hello.cpp:7: error: 'line' was not declared in this scope
hello.cpp:8: error: 'closegraph' was not declared in this scope

kindly assist...

mb 062 13/2, Mac OS X (10.4.10), color-white

Posted on Apr 16, 2008 7:22 AM

Reply
7 replies

Apr 29, 2008 6:41 PM in response to 10may.agn03

So how about a little web searching? I'll get started for you...

For example:

http://developer.apple.com/macosx/architecture/index.html

Which led to this:

http://developer.apple.com/graphicsimaging/opengl/

The initial search also indicated some third party graphics libraries for OS X, for example, http://www.macobserver.com/article/2007/08/20.13.shtml

Good luck!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Executing c graphics programs in Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.