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

[demos] clang-cl compile error #26

Open
gvanem opened this issue Jan 19, 2024 · 0 comments
Open

[demos] clang-cl compile error #26

gvanem opened this issue Jan 19, 2024 · 0 comments

Comments

@gvanem
Copy link

gvanem commented Jan 19, 2024

What is up with the state of the Windows code in the demos?
E.g. compiling http_server_demo/src/main.c using clang-cl v17.0.1 (for x64), gives me this error:

demo/http_server_demo/src/main.c(80,42): error: conflicting types for 'WaitForSingleObject'
   80 | __declspec(dllimport) uint32_t __stdcall WaitForSingleObject(
      |                                          ^
f:\gv\WinKit\Include\10.0.22621.0\um\synchapi.h(346,1): note: previous declaration is here
  346 | WaitForSingleObject(
      | ^
1 error generated.

There should be no need to prototype this OS-function (since <windows.h> should have been included already).
But pre-processing this files gives:

// From <synchapi.h>
__declspec (dllimport) DWORD __stdcall WaitForSingleObject (HANDLE hHandle, DWORD dwMilliseconds);

// From http_server_demo/src/main.c:
__declspec (dllimport) uint32_t __stdcall WaitForSingleObject (void *hHandle, uint32_t dwMilliseconds);

See, not really the same due to the typedefs according to clag-cl. But the same in practice.

With cl, there is only a warning:

demo/http_server_demo/src/main.c(81): warning C4028: formal parameter 2 different from declaration
demo/http_server_demo/src/main.c(81): warning C4142: 'WaitForSingleObject': benign redefinition of type
f:\gv\WinKit\Include\10.0.22621.0\um\synchapi.h(346): note: see declaration of 'WaitForSingleObject'

There is this same issue with all demo/*/main.c files.

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