与教堂的"compileline"一起编译C++



我想在我的教堂库中包含一些C++代码,第一步是让教堂编译器根据此页面编译 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 Worldn");
}

但是当我运行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.

我觉得我正在遵循文档,但我看不到我错过了什么。

Chapel 1.17(尚未发布,但您可以尝试预发布主分支)添加了util/config/compileline --compile-c++,其工作原理类似,但需要C++编译器而不是 C 编译器。

您包含<iostream>用于std::cout但您使用的是<cstdio>中的printf

基本上,你不仅混合了C++和教堂,还混合了C++和C。

相关内容

  • 没有找到相关文章

最新更新