mtk*_*358 -6 c++ compiler-errors
我有这个代码:
FILE *f = fopen(intPath, "r");
Node *n;
if (f) {
try {
n = parse(f, intPath);
} catch (SyntaxError e) {
fclose(f); /***** line 536 *****/
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii(e.filename)->
append(String::fromAscii(":"))->
append(String::fromInt(e.line))->
append(String::fromAscii(":"))->
append(String::fromInt(e.col))->
append(String::fromAscii(": syntax error: "))->
append(String::fromAscii(e.message))
);
}
fclose(f);
return n->eval(scope);
} else {
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii("failed to open file for reading")
),
line,
col
);
}
Run Code Online (Sandbox Code Playgroud)
编译器给出了这个错误:
nodes.cpp:537:40:错误:在
‘(’token
nodes.cpp 之前的预期primary-expression :544:94:错误:令牌‘)’之前的预期‘;’
我不知道它可能是什么,特别是因为该代码示例具有另一个执行相同操作的语句,并且它不会导致错误.
throw LangException(
builtin_classes::exception_class::create_ImportError(
String::fromAscii(e.filename)->
append(String::fromAscii(":"))->
append(String::fromInt(e.line))->
append(String::fromAscii(":"))->
append(String::fromInt(e.col))->
append(String::fromAscii(": syntax error: "))->
append(String::fromAscii(e.message))
) // This closes the function call
; // You didn't close the throw here!
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12220 次 |
| 最近记录: |