C99中的隐式函数声明无效 - 嵌入式Python

时间:2018-02-13 18:46:56

标签: python ios llvm-clang .a

我正在尝试在我的iOS应用中使用this library。我得到了正确的编译,但是当我尝试运行以下内容时出现错误。

代码

#import "pyconfig.h"
//...
- (void)viewDidLoad {
    [super viewDidLoad];

    Py_SetProgramName((char*)[[[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/"] UTF8String]);
    Py_Initialize();
    PyRun_SimpleString("print 'Hello world!'");
}

错误

Error: Implicit declaration of function 'Py_SetProgramName' is invalid in C99
Warning: This function declaration is not a prototype
Error: Implicit declaration of function 'Py_Initialize' is invalid in C99
Warning: This function declaration is not a prototype
Error: Implicit declaration of function 'PyRun_SimpleString' is invalid in C99
Warning: This function declaration is not a prototype

我已关联libpython.a并添加了pylib。我正在使用Xcode 9.2

0 个答案:

没有答案