如何在目标C/XCode中使用CImg? 我知道CLAN可以编译C++文件作为 .mm ,但是CImg只是作为一个个人 .h < /C>文件。无论我是否将扩展名更改为.mm或将其保留为.h,它都无法工作

如何在目标C/XCode中使用CImg? 我知道CLAN可以编译C++文件作为 .mm ,但是CImg只是作为一个个人 .h < /C>文件。无论我是否将扩展名更改为.mm或将其保留为.h,它都无法工作,c++,objective-c,c,xcode,C++,Objective C,C,Xcode,首先,它抱怨找不到cstdio.h。因此,我将所有的cstd..导入更改为它们的c对应项作为 // Include standard C++ headers. // This is the minimal set of required headers to make CImg-based codes compile. #include <stdio.h> // (was #import <cstdio>) #include <stdlib.h> #inclu

首先,它抱怨找不到
cstdio.h
。因此,我将所有的
cstd..
导入更改为它们的c对应项作为

// Include standard C++ headers.
// This is the minimal set of required headers to make CImg-based codes compile.
#include <stdio.h> // (was #import <cstdio>)
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <exception.h>
错误:未知类型名称“命名空间”


这是因为我将
cstdio
更改为
stdio
?我很困惑

答案形式的解决方案供将来参考:


<>编译文件。标题是“代码> >包含从Obj-C++中的< /代码> d,头将被视为C++代码。< /P>你试图编译C++作为C。你想完成什么?您是否已经查找过Obj-C绑定?我正在尝试在iOS项目中使用CIMG(C++库)。我没有找到任何objective-c绑定。那么您可以尝试使用Obj-c++。这是一件可怕的事情,但可能是使用此特定库的唯一方法。不过,我不知道如何使用clang来实现这一点。谢谢,但我尝试通过将文件名更改为
.mm
来实现这一点,但没有成功。还有什么我应该做的吗?你应该把这个头文件编译成Obj-C++-头本身不需要修改。
namespace cimg_library_suffixed {