error building c++ code with winelib when using -mno-cygwin

Questions about Wine on Linux
Locked
gdalex
Newbie
Newbie
Posts: 1
Joined: Thu Sep 21, 2023 8:40 am

error building c++ code with winelib when using -mno-cygwin

Post by gdalex »

Hello,

I'm trying to build c++ code on linux using winelib, code that requires wchar_t to be 2 bytes.
From the winelib documentation, my understanding is that in order to use Unicode and to be able to use standard library calls (e.g. wcslen, wsprintf), I need to link against msvcrt. In order to do that, I need to pass -mno-cygwin to the c++ compiler.

When I try this simple code:

Code: Select all

#include <cstdio>

int main()
{
  return 0;
}
I'm getting the following errors:
/usr/bin/wineg++ -DUNICODE -g -mno-cygwin -std=gnu++17 -MD -MT CMakeFiles/SimpleApp.dir/SimpleApp.cpp.o -MF CMakeFiles/SimpleApp.dir/SimpleApp.cpp.o.d -o CMakeFiles/SimpleApp.dir/SimpleApp.cpp.o -c /home/g/w/SimpleApp/SimpleApp.cpp
In file included from /home/g/w/SimpleApp/SimpleApp.cpp:4:
/usr/include/c++/11/cstdio:176:11: error: ‘vfscanf’ has not been declared in ‘::’
176 | using ::vfscanf;
| ^~~~~~~
/usr/include/c++/11/cstdio:177:11: error: ‘vscanf’ has not been declared in ‘::’
177 | using ::vscanf;
| ^~~~~~
/usr/include/c++/11/cstdio:179:11: error: ‘vsscanf’ has not been declared in ‘::’
179 | using ::vsscanf;
| ^~~~~~~
/usr/include/c++/11/cstdio:186:22: error: ‘vfscanf’ has not been declared in ‘__gnu_cxx’
186 | using ::__gnu_cxx::vfscanf;
| ^~~~~~~
/usr/include/c++/11/cstdio:187:22: error: ‘vscanf’ has not been declared in ‘__gnu_cxx’
187 | using ::__gnu_cxx::vscanf;
| ^~~~~~
/usr/include/c++/11/cstdio:189:22: error: ‘vsscanf’ has not been declared in ‘__gnu_cxx’
189 | using ::__gnu_cxx::vsscanf;
| ^~~~~~~
winegcc: /usr/bin/g++ failed
What am I doing wrong? Without the -mno-cygwin flag, the code compiles just fine.
Locked