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

Visual Studio build fails with C+++20 (using conan) #2307

Open
atif1996 opened this issue Jan 21, 2025 · 0 comments
Open

Visual Studio build fails with C+++20 (using conan) #2307

atif1996 opened this issue Jan 21, 2025 · 0 comments

Comments

@atif1996
Copy link

atif1996 commented Jan 21, 2025

When using the conan recipe for czmq 4.2.1, you get a build error on windows. Note, if you set the compiler.cppstd=17, this still works, so a workaround exists.

Steps to reproduce:

  1. Windows 11 machine with latest visual studio 2022
  2. install conan2 (pip install conan)
  3. Run the conan install command from a visual studio 2022 x64 native shell
conan install --build=missing --requires="czmq/4.2.1" -s compiler.runtime=dynamic -s compiler.cppstd=20  --build="czmq/4.2.1" --profile default 

It will error out because a string literal loses a const qualifier. It can be corrected by fixing the core or setting a compiler flag to ignore it.

Example errors:

C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zactor.c(341,23): error C2664: 'zactor_t *zactor_new(zactor_fn (__cdecl *),void *)': cannot convert argument 2 from 'const char [13]' to 'void *' [C:\Users\atif1\.cona
n2\p\b\czmq5d1f91a180583\b\build\czmq-static.vcxproj]
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zactor.c(341,47):
      Conversion loses qualifiers
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zactor.c(109,1):
      see declaration of 'zactor_new'
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zactor.c(341,23):
      while trying to match the argument list '(overloaded-function, const char [13])'

C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,5): error C2440: 'initializing': cannot convert from 'const char [7]' to 'char *' [C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\build\czmq-static.vcxpro
j]
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,5):
      Conversion from string literal loses const qualifier (see /Zc:strictStrings)

C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,15): error C2440: 'initializing': cannot convert from 'const char [10]' to 'char *' [C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\build\czmq-static.vcxp
roj]
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,15):
      Conversion from string literal loses const qualifier (see /Zc:strictStrings)

C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,28): error C2440: 'initializing': cannot convert from 'const char [7]' to 'char *' [C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\build\czmq-static.vcxpr
oj]
      C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,28):
      Conversion from string literal loses const qualifier (see /Zc:strictStrings)

C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\src\src\zarmour.c(61,38): error C2440: 'initializing': cannot convert from 'const char [10]' to 'char *' [C:\Users\atif1\.conan2\p\b\czmq5d1f91a180583\b\build\czmq-static.vcxp
roj]
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

1 participant