0

I have problem. Im compiling following c-file

#include <stdio.h>
#include <GLUT/glut.h>

int main() {

return 0;
}

commands:

clang -framework GLUT main.c
clang -F/System/Library/Frameworks/GLUT.framework/ main.c
clang -F/System/Library/Frameworks/GLUT.framework/GLUT main.c

and i get error:

fatal error: 'GLUT/glut.h' file not found
#include <GLUT/glut.h>
     ^
1 error generated.

How properly to include glut?

user2417329
  • 294
  • 1
  • 4
  • 11

2 Answers2

0

Looks like you for some reason doesn't have GLUT framework on your machine. I have no errors compiling your example on my machine (10.8.4). Take a look at this how-to for some additional info

Edit
Don't use custom compilers packages. Install Command Line Tools to use compiler in terminal or run it via xcrun

cody
  • 3,233
  • 1
  • 22
  • 25
  • No, i have GLUT framework on my machine. when i attach glut to my project through xcode all ritght. im installed clang via following pkg https://github.com/kennethreitz/osx-gcc-installer because after installing xcode command did not appear in terminal – user2417329 Jul 01 '13 at 17:51
  • Try to install command line tools to use clang in terminal. Or run clang from xcode environment using xcrun utility: `xcrun clang -framework GLUT main.c` – cody Jul 01 '13 at 18:28
  • "Try to install command line tools to use clang in terminal" @cody, please details – user2417329 Jul 01 '13 at 18:50
  • thank you very much for help. im decided my problem. im uninstalled xcode and gcc.pkg command sudo /Library/Developer/Shared/uninstall-devtools --mode=all and then downloaded and installed Command Line Tools (OS X Mountain Lion) for Xcode - April 2013 from [is there](https://developer.apple.com/downloads/) – user2417329 Jul 01 '13 at 22:07
  • ok, not only clang, as well as clang++, gcc, g++. if im not mistaken. – user2417329 Jul 02 '13 at 06:35
0

This command should work:

clang -F/System/Library/Frameworks -framework GLUT main.c

The -F/System/Library/Frameworks specifies the path to the framework(s), and the -framework GLUT specifies which framework(s) to include.

maditya
  • 8,626
  • 2
  • 28
  • 28
  • yes, this command should work, im agree. i tried it to use, but fail. Problem is decided, read answer by @cody and my comment to it. Thank. – user2417329 Jul 02 '13 at 06:40