emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Compile error with strsafe.h

Open hamtiko opened this issue 10 years ago • 3 comments

Hello All,

I have some c++ analyzer code which is need compile to js using emscripten.

In the c++ code I have include strsafe.h file. During compile it is returning following error:

In file included from RTAnalyzer.cpp:6: C:\Program Files (x86)\Windows Kits\8.0\Include\shared\strsafe.h:10586:12: error: use of undeclared identifier '_vsnprintf'; did you mean 'vsnprintf'? iRet = _vsnprintf(pszDest, cchMax, pszFormat, argList); ^~~~~~~~~~ vsnprintf C:\Program Files\Emscripten\emscripten\1.35.0\system\include\libc\stdio.h:110:5: note: 'vsnprintf' declared here int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); ^ In file included from RTAnalyzer.cpp:6: C:\Program Files (x86)\Windows Kits\8.0\Include\shared\strsafe.h:10716:12: error: use of undeclared identifier '_vsnwprintf'; did you mean 'vsnprintf'? iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); ^~~~~~~~~~~ vsnprintf C:\Program Files\Emscripten\emscripten\1.35.0\system\include\libc\stdio.h:110:5: note: 'vsnprintf' declared here int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); ^ In file included from RTAnalyzer.cpp:6: C:\Program Files (x86)\Windows Kits\8.0\Include\shared\strsafe.h:10716:24: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'STRSAFE_LPWSTR' (aka 'wchar_t *') iRet = _vsnwprintf(pszDest, cchMax, pszFormat, argList); ^~~~~~~ C:\Program Files\Emscripten\emscripten\1.35.0\system\include\libc\stdio.h:110:31: note: passing argument to parameter here int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list); ^ In file included from RTAnalyzer.cpp:6: C:\Program Files (x86)\Windows Kits\8.0\Include\shared\strsafe.h:10913:26: error: use of undeclared identifier 'getwc' wchar_t ch = getwc(stdin); ^ C:\Program Files (x86)\Windows Kits\8.0\Include\shared\strsafe.h:10916:23: error: use of undeclared identifier 'WEOF' if (ch == WEOF)

When I have tried to compile same code using windows cl compiler (by removing #include <emscripten/emscripten.h> line from code) it is working without any issue.

Could You please help me with this issue?

hamtiko avatar Sep 05 '16 14:09 hamtiko

It looks like your project uses _vsnprintf, which is not a standard libc symbol. Perhaps on windows it provides it and links it to vsnprintf (no prefix _) or something like that?

kripken avatar Sep 08 '16 17:09 kripken

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

stale[bot] avatar Aug 30 '19 18:08 stale[bot]

@kripken Thanks for your response.

It was 3 years ago when I had this issue and unfortunately now I can't even recall what was the issue and how I have solved it (or have I solved it or not :) ).

So closing this issue

hamtiko avatar Sep 06 '19 07:09 hamtiko