Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown type name 'namespace' Xcode Boost

Tags:

xcode

boost

I want to use boost in my Xcode project.(Xcode version 4.3.2)

I had build the boost from the MacPorts, and made the environment variables set.

But when I build the prj, there was the error:

Unknown type name 'namespace'

and the error code below:

// This file is automatically generated. Do not edit.
// ['../../libs/compatibility/generate_cpp_c_headers.py']
// Wed Jul 23 12:11:19 2003 ('GMTST', 'GMTST')

#ifndef __CSTDDEF_HEADER
#define __CSTDDEF_HEADER

#include <stddef.h>

namespace std {
  using ::ptrdiff_t;
  using ::size_t;
}

#endif // CSTDDEF_HEADER
like image 533
setimouse Avatar asked Jun 04 '12 07:06

setimouse


1 Answers

the auto generated code is C++, not Objective-C. Objective-C compiler rejects the invalid keyword 'namespace'.

To make it work change you project settings as follows: - go to you Project Settings and choose the Target - select Build Settings -> Apple LLVM compiler X.X - Language -> Compile Sources As and set it to Objective-C++ which allows mixture of Objective-C and C++.

like image 169
Yana Avatar answered Sep 25 '22 21:09

Yana