0

I am trying to use GLM to load a .obj object in my Objective-C Program (Xcode 4.4 Mac Os X). I have added the glm folder to my project. i try to import it using #import "glm/glm.hpp", but the program doesn't build. some of the errors are the following: (this errors are produced in the GLM files)

namespace glm{         //Unknown type name 'namespace'
namespace detail
{ .....   

It doesn't find the cstdlib, cmath, and other libraries.

This happens because my program is in Objective-c and the GLM doesn't work with this language?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 2
    I think you're slightly confused. There are two libraries named GLM: 1) [OpenGL Mathematics](http://glm.g-truc.net/), and 2) [GLM: Wavefront OBJ file loader](http://devernay.free.fr/hacks/glm/). #1 does not do any .obj loading – Tim Aug 30 '12 at 04:11

2 Answers2

1

Those are all symptoms of trying to compile a C++ application with a C compiler. Namespace is a C++ keyword, and cstdlib, cmath, etc. are C++ names for standard C headers. You'll have to migrate your project to Objective-C++ to be able to use GLM.

nevsan
  • 1,385
  • 9
  • 8
  • Don't forget to rename any .m files to .mm as part of the process. Often Xcode is stubborn about this extension being correct. – ravuya Aug 30 '12 at 04:44
1

Any files that uses the GLM library will require that file extensions to be renamed to .mm as it uses Objective-C++. Also, as it is only a file, and not a framework, you only need to put #import "glm.hpp"

TheAmateurProgrammer
  • 9,252
  • 8
  • 52
  • 71