-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script_translator.cc无法编译 #462
Comments
怎樣重現這個編譯錯誤? |
Previous boost library (1.75) may implicitly include cmath, but the latest version (1.76) does not, so the calls to exp are undefined. This commit include cmath in script_translator.cc and table_translator.cc to fix the issue (rime#462).
The issue can be fixed by adding |
Previous boost library (1.75) may implicitly include cmath, but the latest version (1.76) does not, so the calls to exp are undefined. This commit include cmath in script_translator.cc and table_translator.cc to fix the issue (#462).
謝謝。 |
This fix looks wrong. You are including |
@jwakely You are right. I tested the fix on GCC with libstdc++ and the code compiled, but this behavior, however, is not reliable since the standard library can choose to declare |
OK, will do. |
As noted in rime#462, including <cmath> only guarantees that std::exp is declared, so calling exp(double) unqualified is not portable. This adds a using-declaration for std::exp so that unqualified calls are guaranteed to work.
As noted in #462, including <cmath> only guarantees that std::exp is declared, so calling exp(double) unqualified is not portable. Squashed commit with a style change to the original PR: commit 8b9d48c0340f3fb82de59a6f7ec71ddfd86a602f Author: Chen Gong <[email protected]> Date: Sun Jan 16 00:49:47 2022 +0800 commit df4fe3e Author: Jonathan Wakely <[email protected]> Date: Tue Aug 10 10:18:38 2021 +0100 Closes #476
As noted in #462, including <cmath> only guarantees that std::exp is declared, so calling exp(double) unqualified is not portable. Squashed commit with a style change to the original PR: commit 8b9d48c0340f3fb82de59a6f7ec71ddfd86a602f Author: Chen Gong <[email protected]> Date: Sun Jan 16 00:49:47 2022 +0800 commit df4fe3e Author: Jonathan Wakely <[email protected]> Date: Tue Aug 10 10:18:38 2021 +0100 Closes #476
librime-1.7.2.tar.gz
[ 62%] Building CXX object src/CMakeFiles/rime.dir/rime/gear/script_translator.cc.o
/home/xxxx/temp/rime-builds/librime-1.7.2/src/rime/gear/script_translator.cc: 在成员函数‘void rime::ScriptTranslation::PrepareCandidate()’中:
/home/xxxx/temp/rime-builds/librime-1.7.2/src/rime/gear/script_translator.cc:490:23: 错误:‘exp’在此作用域中尚未声明
490 | cand->set_quality(exp(entry->weight) +
| ^~~
/home/xxxx/temp/rime-builds/librime-1.7.2/src/rime/gear/script_translator.cc:504:23: 错误:‘exp’在此作用域中尚未声明
504 | cand->set_quality(exp(entry->weight) +
| ^~~
make[2]: *** [src/CMakeFiles/rime.dir/build.make:1238:src/CMakeFiles/rime.dir/rime/gear/script_translator.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:233:src/CMakeFiles/rime.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2
搜索了之后发现似乎和编译时的条件 -lm 有关,但不知如何处理。
The text was updated successfully, but these errors were encountered: