使用Chapel" compileline"编译C ++;

时间:2017-11-29 18:25:32

标签: c++ chapel

我想在我的chapel libs中包含一些C ++代码,第一步是让Chapel编译器根据this page编译cpp。但是,我收到了一个奇怪的错误。我的.cpp

/* Hello World program
 * `/Users/buddha/github/chapel/util/config/compileline --compile` hello.cpp
 * */

//#include<stdio.h>   // just fine
#include<iostream>  // gastro-intestinal distress...

int main()
{
    printf("Hello World\n");
}

但是当我运行compileline时出现错误

 `/Users/buddha/github/chapel/util/config/compileline --compile` hello.cpp 
In file included from hello.cpp:6:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__locale:18:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/mutex:189:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__mutex_base:17:
/Library/Developer/CommandLineTools/usr/include/c++/v1/__threading_support:156:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port();
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/__threading_support:300:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port() {
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/__threading_support:301:12: error: use of undeclared identifier 'pthread_mach_thread_np'
    return pthread_mach_thread_np(pthread_self());
           ^
3 errors generated.

我觉得我正在遵循文档,但我不知道自己错过了什么。

2 个答案:

答案 0 :(得分:2)

Chapel 1.17(尚未发布,但您可以尝试预发布主分支)添加util/config/compileline --compile-c++,它的工作方式类似但是请求C ++编译器而不是C编译器。

答案 1 :(得分:1)

<iostream>包括std::cout,但您正在printf使用<cstdio>

基本上你不只是混合C ++和教堂,还有C ++和C。