[GH-ISSUE #57] Warning about redefinition of SLIST_ENTRY #46

Closed
opened 2026-05-05 11:31:05 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @utelle on GitHub (Jun 29, 2016).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/57

Originally assigned to: @jmcnamara on GitHub.

The source file packager.c includes the header file windows.h. At least using Visual C++ 2010 I get a warning that the symbol SLIST_ENTRY is redefined in header file winnt.h which is indirectly included by windows.h. It's just a warning and the symbol is not used in packager.c, so no harm is done. However, it might be a good idea to rename the symbol in libxlsxwriter to something else to avoid name clashes (and thus potential problems).

Originally created by @utelle on GitHub (Jun 29, 2016). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/57 Originally assigned to: @jmcnamara on GitHub. The source file `packager.c` includes the header file `windows.h`. At least using Visual C++ 2010 I get a warning that the symbol `SLIST_ENTRY` is redefined in header file `winnt.h` which is indirectly included by `windows.h`. It's just a warning and the symbol is not used in `packager.c`, so no harm is done. However, it might be a good idea to rename the symbol in `libxlsxwriter` to something else to avoid name clashes (and thus potential problems).
gitea-mirror 2026-05-05 11:31:05 -06:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@jmcnamara commented on GitHub (Jun 29, 2016):

Hi Ulrich,

I don't see that warning using this project in MSVC 2013.

The SLIST_ENTRY is a macro definition of a struct and it comes from the FreeBSD/Linux header queue.h which is included with libxlsxwriter.

So I think you will just have to live with this warning in MSVC 2010.

John

<!-- gh-comment-id:229312634 --> @jmcnamara commented on GitHub (Jun 29, 2016): Hi Ulrich, I don't see that warning using this [project ](https://github.com/jmcnamara/MSVCLibXlsxWriter)in MSVC 2013. The `SLIST_ENTRY` is a macro definition of a struct and it comes from the FreeBSD/Linux header `queue.h` which is included with libxlsxwriter. So I think you will just have to live with this warning in MSVC 2010. John
Author
Owner

@utelle commented on GitHub (Jun 29, 2016):

Interesting. Maybe this warning is related to the Windows SDK in use - which might be different for MSVC 2013.

Some googling reveals that other projects seem to be affected, too. Some define a different symbol to avoid the warning. I also found a version of queue.h, which explicitly undefines the symbol before redefining it. However, the latter only works if windows.h is included before queue.h. For libxlsxwriter this would currently not work, since windows.h is included afterwards.

Personally, I can live with the warning. So feel free to close this issue.

<!-- gh-comment-id:229337706 --> @utelle commented on GitHub (Jun 29, 2016): Interesting. Maybe this warning is related to the Windows SDK in use - which might be different for MSVC 2013. Some googling reveals that other projects seem to be affected, too. Some define a different symbol to avoid the warning. I also found a version of [queue.h](https://searchcode.com/codesearch/view/11905748/), which explicitly undefines the symbol before redefining it. However, the latter only works if `windows.h` is included **before** `queue.h`. For `libxlsxwriter` this would currently not work, since `windows.h` is included **afterwards**. Personally, I can live with the warning. So feel free to close this issue.
Author
Owner

@jmcnamara commented on GitHub (Jun 29, 2016):

Okay. Thanks for the followup. Closing.

<!-- gh-comment-id:229341955 --> @jmcnamara commented on GitHub (Jun 29, 2016): Okay. Thanks for the followup. Closing.
Author
Owner

@jmcnamara commented on GitHub (Jul 3, 2016):

Hi,

I pushed a fix for this warning to master. Basically it undefs the macro before including windows.h.

When you get a chance you can try it and let me know if it fixes the warning on Windows.

John

<!-- gh-comment-id:230152847 --> @jmcnamara commented on GitHub (Jul 3, 2016): Hi, I pushed a fix for this warning to master. Basically it undefs the macro before including `windows.h`. When you get a chance you can try it and let me know if it fixes the warning on Windows. John
Author
Owner

@utelle commented on GitHub (Jul 3, 2016):

Yes, this eliminates the warning.

<!-- gh-comment-id:230165658 --> @utelle commented on GitHub (Jul 3, 2016): Yes, this eliminates the warning.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#46
No description provided.