Skip to content

Commit 7a69c4f

Browse files
committed
fix(learn): 解决 linux 上编译错误
Signed-off-by: YdrMaster <[email protected]>
1 parent a56a4f9 commit 7a69c4f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

learn/test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ static bool test_exercise(std::ostream &os, int n, const char *log) {
3636

3737
bool test_exercise(int n, const char *log) {
3838
if (log) {
39-
auto log_ = fs::absolute(fs::path(XMAKE) / "log" / log);
40-
auto log__ = log_.string();
41-
return test_exercise(std::fstream(log_, std::ios::out | std::ios::app), n, log__.c_str());
39+
const auto log_ = fs::absolute(fs::path(XMAKE) / "log" / log);
40+
const auto log__ = log_.string();
41+
auto file = std::fstream(log_, std::ios::out | std::ios::app);
42+
return test_exercise(file, n, log__.c_str());
4243
} else {
4344
return test_exercise(std::cout, n, nullptr);
4445
}

xmake.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
add_rules("mode.debug", "mode.release")
22
set_encodings("utf-8")
3+
set_warnings("all")
4+
set_languages("cxx17")
35

46
target("test")
57
set_kind("static")
6-
set_languages("cxx17")
78
add_defines(string.format("__XMAKE__=\"%s\"", os.scriptdir():gsub("\\", "/")))
89
add_files("learn/test.cpp")
910

1011
target("learn")
1112
set_kind("binary")
12-
set_languages("cxx17")
1313
add_deps("test")
1414
add_files("learn/learn.cpp")
1515

1616
target("summary")
1717
set_kind("binary")
18-
set_languages("cxx17")
1918
add_deps("test")
2019
add_files("learn/summary.cpp")

0 commit comments

Comments
 (0)