From 4c15a02b88f74b209a4290981fea6754280e7da9 Mon Sep 17 00:00:00 2001 From: Rui Guo Date: Thu, 13 Oct 2016 22:35:04 +0800 Subject: change to work on windows with msvc --- qlua/qlua.cpp | 2 +- qlua/qluaconsole_win.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qlua/qlua.cpp b/qlua/qlua.cpp index 548073c..448bd34 100644 --- a/qlua/qlua.cpp +++ b/qlua/qlua.cpp @@ -133,7 +133,7 @@ main(int argc, char **argv) args_for_lua += const_cast(ideStyle.constData()); } #if defined(TORCH7) - args_for_lua += "-ltorch-env"; + args_for_lua += "-lenv"; #endif while(i < argc_for_both) args_for_lua += argv_for_both[i++]; diff --git a/qlua/qluaconsole_win.cpp b/qlua/qluaconsole_win.cpp index 50bee0b..3ac3564 100644 --- a/qlua/qluaconsole_win.cpp +++ b/qlua/qluaconsole_win.cpp @@ -466,11 +466,19 @@ QLuaConsole::Private::redirect(bool flag) int fd1 = sThread.fds[1]; int fd2 = fd1; if (! trueStdout) +#ifndef _MSC_VER stdout->_file = 1; +#else + freopen("CON", "w", stdout); +#endif else if (! flag) fd1 = _fileno(trueStdout); if (! trueStderr) +#ifndef _MSC_VER stderr->_file = 2; +#else + freopen("CON", "w", stderr); +#endif else if (! flag) fd2 = _fileno(trueStderr); _dup2(fd1, _fileno(stdout)); -- cgit v1.2.3