Skip to content

Commit

Permalink
fix(learn): 解决 linux 上编译错误
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Jul 11, 2024
1 parent a56a4f9 commit 7a69c4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions learn/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ static bool test_exercise(std::ostream &os, int n, const char *log) {

bool test_exercise(int n, const char *log) {
if (log) {
auto log_ = fs::absolute(fs::path(XMAKE) / "log" / log);
auto log__ = log_.string();
return test_exercise(std::fstream(log_, std::ios::out | std::ios::app), n, log__.c_str());
const auto log_ = fs::absolute(fs::path(XMAKE) / "log" / log);
const auto log__ = log_.string();
auto file = std::fstream(log_, std::ios::out | std::ios::app);
return test_exercise(file, n, log__.c_str());
} else {
return test_exercise(std::cout, n, nullptr);
}
Expand Down
5 changes: 2 additions & 3 deletions xmake.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
add_rules("mode.debug", "mode.release")
set_encodings("utf-8")
set_warnings("all")
set_languages("cxx17")

target("test")
set_kind("static")
set_languages("cxx17")
add_defines(string.format("__XMAKE__=\"%s\"", os.scriptdir():gsub("\\", "/")))
add_files("learn/test.cpp")

target("learn")
set_kind("binary")
set_languages("cxx17")
add_deps("test")
add_files("learn/learn.cpp")

target("summary")
set_kind("binary")
set_languages("cxx17")
add_deps("test")
add_files("learn/summary.cpp")

0 comments on commit 7a69c4f

Please sign in to comment.