NVIDIA / NVTX

The NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications.
Apache License 2.0
310 stars 48 forks source link

Fix Windows build when WIN32_LEAN_AND_MEAN is defined by always including stdlib.h (nvbug 200683304) #84

Closed NBickford-NV closed 3 weeks ago

NBickford-NV commented 1 year ago

This fixes the bug where this code:

#define WIN32_LEAN_AND_MEAN
#include <nvtx3/nvToolsExt.h>

int main() {}

outputs

1>...\include\nvtx3\nvtxDetail\nvtxInit.h(164,32): error C3861: '_wgetenv': identifier not found

Normally, #include <Windows.h> in nvtxImpl.h would include <stdlib.h> — unless WIN32_LEAN_AND_MEAN is defined. In that case, nothing defines _wgetenv. This pull request should fix that by moving #include <stdlib.h> out of the Linux-only preprocessor branch.

Thanks!

evanramos-nvidia commented 3 weeks ago

Closing this PR because the issue has been fixed on the dev branch.