Skip to content

Including quick.js in a cpp file fails to compile with MSVC 2022 #608

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

Closed
jcoder58 opened this issue Oct 18, 2024 · 1 comment
Closed

Including quick.js in a cpp file fails to compile with MSVC 2022 #608

jcoder58 opened this issue Oct 18, 2024 · 1 comment

Comments

@jcoder58
Copy link

I want to use QuickJS in a C++ application. When I compile with the MS compiler, I get the following compile errors:

0>quickjs.h(487): Error C4576 : a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
0>quickjs.h(492): Error C4576 : a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
0>quickjs.h(502): Error C4576 : a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax

If I remove the () from JS_MKVAL (see below), it compiles.

#define JS_MKVAL(tag, val) JSValue{ JSValueUnion{ .int32 = val }, tag }
@saghul
Copy link
Contributor

saghul commented Oct 19, 2024

A PR would be most welcome,and I'd also like a CI test that uses the c++ compiler so we don't break it again in the future.

bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
Check that quickjs.h parses without error when fed to a C++ compiler.

Fixes: quickjs-ng/quickjs#608
Co-authored-by: Saúl Ibarra Corretgé <[email protected]>
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