[英]How to use CImg in Objective C / XCode?
我知道clang可以将C ++文件编译为.mm
,但是CImg只是一个单独的.h
文件。 无论我将扩展名更改为.mm
还是将其保留为.h
,它均不起作用。
首先,它抱怨找不到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>
引入x11库后,我克服了导入错误而变成语法错误:
namespace cimg_library_suffixed {
错误: 未知类型名称“命名空间”
这是因为我将cstdio
更改为stdio
吗? 我糊涂了..
答案形式的解决方案,以供将来参考:
以Obj-C ++的形式编译标头为#include
d的文件,标头将被视为C ++代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.