Skip to content
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

Rack v1: Compile failure on Windows (cross-compile) #40

Closed
cschol opened this issue Jun 28, 2019 · 3 comments
Closed

Rack v1: Compile failure on Windows (cross-compile) #40

cschol opened this issue Jun 28, 2019 · 3 comments

Comments

@cschol
Copy link
Contributor

cschol commented Jun 28, 2019

When cross-compiling for Windows on Linux (which is what the build server does), the following issue occurs:

Randoms.cpp.o src/Randoms.cpp
src/EssEff.cpp: In member function ‘std::__cxx11::string EssEff::getAbsolutePath(std::__cxx11::string)’:
src/EssEff.cpp:130:30: error: ‘toWstring’ was not declared in this scope
         std::wstring pathW = toWstring(path);
                              ^~~~~~~~~
src/EssEff.cpp:130:30: note: suggested alternative:
In file included from /home/cschol/src/Rack-1.0/dist/Rack-SDK/include/rack.hpp:6:0,
                 from /home/cschol/src/Rack-1.0/dist/Rack-SDK/include/rack0.hpp:2,
                 from src/RJModules.hpp:1,
                 from src/EssEff.cpp:1:
/home/cschol/src/Rack-1.0/dist/Rack-SDK/include/string.hpp:15:14: note:   ‘rack::string::toWstring’
 std::wstring toWstring(const std::string &s);
              ^~~~~~~~~
src/EssEff.cpp:134:20: error: ‘fromWstring’ was not declared in this scope
             return fromWstring(absPathC);
                    ^~~~~~~~~~~
src/EssEff.cpp:134:20: note: suggested alternative:
In file included from /home/cschol/src/Rack-1.0/dist/Rack-SDK/include/rack.hpp:6:0,
                 from /home/cschol/src/Rack-1.0/dist/Rack-SDK/include/rack0.hpp:2,
                 from src/RJModules.hpp:1,
                 from src/EssEff.cpp:1:
/home/cschol/src/Rack-1.0/dist/Rack-SDK/include/string.hpp:14:13: note:   ‘rack::string::fromWstring’
 std::string fromWstring(const std::wstring &s);
             ^~~~~~~~~~~
@Miserlou
Copy link
Owner

Should be resolved now.

@cschol
Copy link
Contributor Author

cschol commented Jun 29, 2019

Still does not compile.

Fix:

diff --git a/src/EssEff.cpp b/src/EssEff.cpp
index 825c7a8..48b6379 100644
--- a/src/EssEff.cpp
+++ b/src/EssEff.cpp
@@ -2,6 +2,9 @@
 #include "osdialog.h"
 #include "common.hpp"
 #include <locale> // for wstring_convert
+#if defined ARCH_WIN
+#include <codecvt>
+#endif
 #include <iostream>
 #include <cmath>
 #include <sstream>
@@ -133,7 +136,7 @@ std::string EssEff::getAbsolutePath(std::string path){
         wchar_t buf[PATH_MAX];
         wchar_t *absPathC = _wfullpath(buf, pathW.c_str(), PATH_MAX);
         if (absPathC)
-            return fromWstring(absPathC);
+            return string::fromWstring(absPathC);
     #endif
     return "";
 }

@Miserlou
Copy link
Owner

Miserlou commented Jul 1, 2019

Thanks, you rock! Applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants