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

Compiling on windows : Error #6

Closed
benkuper opened this issue Oct 23, 2019 · 8 comments
Closed

Compiling on windows : Error #6

benkuper opened this issue Oct 23, 2019 · 8 comments

Comments

@benkuper
Copy link

Hello,
I'm trying to compile quickJS with VS2019 and the I narrowed down the errors to only one type, related to this templated function

template <typename R, typename... Args, R (* F)(Args...), bool PassThis>
struct js_traits<fwrapper<F, PassThis>>

template <typename R, class T, typename... Args, R (T::*F)(Args...)>
struct js_traits<fwrapper<F>>

template <typename R, class T, typename... Args, R (T::*F)(Args...) const>
struct js_traits<fwrapper<F>>

The error I get is

E0842 template parameter "R" is not used in or cannot be deduced from the template argument list of class template "qjs::js_traits<qjs::fwrapper<F, false>>"

When I comment out those 3 functions, it actually compiles (I couldn't test because I have yet to compile the static quickjs.lib file

So I have 2 questions :

  • Do you have an idea on how to make it working with MSVC ?
  • Are those functions critical to use QuickJSPP or are they just helpers ? (I'm actually just getting started on QuickJS, we're building a JUCE module)

Thank you !

@ftk
Copy link
Owner

ftk commented Oct 23, 2019

Seems to be compiling fine for me:
image
Those functions are used to wrap C++ functions (.function<&myfunction>())
Also, quickjs already works fine with MinGW on Windows

@benkuper
Copy link
Author

Thanks for the fast reply, this is what I get though, with the same command line.
Screenshot_1

Also, my goal is to export a static library out of it so I can use it as a JUCE Module.
Would it be possible if not too complicated for you to put an x64 static .lib (and / or dynamic with .dll) in the release section of the repo ? It would sure help a lot of people trying to use this super lib and not having the whole toolchain for it.
I actually could export a static library from MinGW of quickJS but then a lot of dependencies due to the compilation through gcc made it overcomplicated and not worth it. I'm sure there is a simple solution to that but we've spend the whole day trying to figure out how to make the code compatible through Visual Studio 2019 and didn't get a lot of good results..

Also, what option are you using in CMake to generate the project ? Because I had to change example.cpp to include "../quickjspp.hpp" for it to actually find it, and the file structure you have in your screenshot is not the one in the repo.

@webfolderio
Copy link

Visual Studio 2019 and didn't get a lot of good results

QuickJs not compatible with MSVC. It uses GCC specific (attribute etc.) features.

@ftk
Copy link
Owner

ftk commented Nov 19, 2019

I've built 32-bit quickjs dll with mingw: https://github.com/ftk/quickjspp/releases/tag/v20191027
I don't think 64-bit mingw dlls can be used with msvc

@ftk ftk closed this as completed Nov 19, 2019
@benkuper
Copy link
Author

too bad, so no possibility of using it with an MSVC 64-bit project then ?

@ftk
Copy link
Owner

ftk commented Nov 19, 2019

Oof. The problem was that MSVC doesn't define x86_64, so JSValue was nan-boxed by quickjs. Added 64bit dll, seems to work with patched quickjs.h on MSVC.

@benkuper
Copy link
Author

Nice !! thank you very much, I'll tell you when I'll get back to this development, but it's definitely good news !

@DoKtor-K-GBLCW
Copy link

I just tested It
On Visual Studio 2019 (x86 - Debug Build)
And It compiles and Works without Any problems 💜

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

4 participants