ufhacks.blogg.se

Macos compile c program
Macos compile c program





macos compile c program

LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT Use the following include directives: #if _WIN32Īnd use the following in your makefile: # Linux (default) Follow these instructions to have your programs and makefiles work on any computer, regardless of what operating system it’s running on. It can be troublesome rewriting your program every time you switch computers. You must use a tab to indent the gcc line (spaces will not work). A simple makefile for Linux is: LIBS = -lglut -lGLU -lGL This makes it easy to recompile and test your program without typing the long gcc commands above.Ī makefile is always called Makefile (with no extension). You are required to use a makefile to compile your programs for all assignments. On Mac OS X you need to change the #include directives slightly to: #include Īnd compile it by typing (in a terminal window): gcc -Wno-deprecated-declarations -o hello hello.c -framework GLUT -framework OpenGL -framework Carbon Only started experimenting with this, although some students used it Windows Subsystem for Linux aka WSL, which appeared late 2016.

macos compile c program

On Windows we have previously suggested students install xming or cygwin or a Linux virtual machine in VirtualBox. Here’s a simple OpenGL program that does nothing: #include Īssuming this program is saved in hello.c, you can compile it by typing: gcc -o hello hello.c -lglut -lGLU -lGL Compiling OpenGL programs on Linux, OS X and Windows







Macos compile c program