基本 "Production-grade" hello world 给出错误
Basic "Production-grade" hello world gives errors
module Hello
{
config const message: string = "Hello, world!";
proc main()
{
writeln( message );
}
}
程序编译正常,没有错误,但我尝试 运行 时出现以下错误。
./hello2-module.chpl: line 1: module: command not found
./hello2-module.chpl: line 4: syntax error near unexpected token `('
./hello2-module.chpl: line 4: ` proc main()'
有点不对。
您没有说明您是如何尝试 运行 生成的可执行文件的,但是从您显示的输出看来,您可能正在尝试 运行 Chapel 源文件(例如, ./hello2-module.chpl
) 而不是编译器生成的可执行文件(例如,./Hello
与最新版本的 Chapel 或 ./a.out
与旧版本)。
module Hello
{
config const message: string = "Hello, world!";
proc main()
{
writeln( message );
}
}
程序编译正常,没有错误,但我尝试 运行 时出现以下错误。
./hello2-module.chpl: line 1: module: command not found
./hello2-module.chpl: line 4: syntax error near unexpected token `('
./hello2-module.chpl: line 4: ` proc main()'
有点不对。
您没有说明您是如何尝试 运行 生成的可执行文件的,但是从您显示的输出看来,您可能正在尝试 运行 Chapel 源文件(例如, ./hello2-module.chpl
) 而不是编译器生成的可执行文件(例如,./Hello
与最新版本的 Chapel 或 ./a.out
与旧版本)。