使用 Chapel 的 "compileline" 编译 C++
Compiling C++ with Chapel's "compileline"
我想在我的 Chapel 库中包含一些 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.
我觉得我正在按照文档进行操作,但我没有看到我遗漏了什么。
您为 std::cout
添加了 <iostream>
,但您使用的是 <cstdio>
的 printf
。
基本上,您混合的不仅仅是 C++ 和 chapel,还有 C++ 和 C。
Chapel 1.17(尚未发布,但您可以尝试预发布的 master 分支)添加了 util/config/compileline --compile-c++
,其工作方式类似,但需要 C++ 编译器而不是 C 编译器。
我想在我的 Chapel 库中包含一些 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.
我觉得我正在按照文档进行操作,但我没有看到我遗漏了什么。
您为 std::cout
添加了 <iostream>
,但您使用的是 <cstdio>
的 printf
。
基本上,您混合的不仅仅是 C++ 和 chapel,还有 C++ 和 C。
Chapel 1.17(尚未发布,但您可以尝试预发布的 master 分支)添加了 util/config/compileline --compile-c++
,其工作方式类似,但需要 C++ 编译器而不是 C 编译器。