lundi 17 juillet 2017

error C3861: '_InterlockedIncrement': identifier not found in VS2013 even when InterlockedIncrement is not used

I've 2 static libraries. InnerUseMe.lib (has InnerUseMe.h) & Outeruseme.lib (Outeruseme.h). Both of which build (compile & link) in VS2013 absolutely fine.

1) Outeruseme.lib uses InnerUseMe.lib & InnerUseMe.h. Hence "Outeruseme.lib" statically links with InnerUseMe.lib.

2) I create a sample EXE "Just printing "Hello World" & statically link with "InnerUseMe.lib" - I'm able to use teh APIs exposed by "InnerUseMe.lib" fine & my EXE now compiles fine.

4) HOWEVER, if i create a sample EXE with no source code or Just printing "Hello World" & just include it's header file "OuterUseMe.h" (and NOT even link the "OuterUseMe.lib", I get the following bunch of compilation errors, where it complaints

that "_InterlockedIncrement': identifier not found". Point is that I've NOT used this "InterlockedIncrement" anywhere in my "InnerUseMe.lib/.h & Outeruseme.lib/.h", then how can my simple Hello world code complain of this?

Since, I'm getting this error even on including the "OuterUseMe.h" header file, I (and not even linking library), there is something in the header file of these 2 libs which is calling "_InterlockedIncrement", although Ive NOT used _InterlockedIncrement explicitly.

FYI, I've used the following headers in these 2 static libs: InnerUseMe.lib/.h uses: include iostream

include vector

include list

include exception

include mutex

include thread

include memory

include string

include fstream

Outeruseme.lib/.h uses: include vector

include list

include exception

include mutex

include thread

include memory

Not sure if these headers can internally call _InterlockedIncrement. But when my both libraries are compiling fine wh i sthat I'm getting below error when I just include the header file of Outeruseme.h.

1>c:\program files (x86)\windows kits\8.1\include\um\winnt.h(19832): error C3861: '__readfsdword': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8828): error C3861: '_InterlockedIncrement': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8837): error C3861: '_InterlockedIncrement': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8859): error C3861: '_InterlockedDecrement': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8868): error C3861: '_InterlockedDecrement': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8893): error C3861: '_InterlockedExchange': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8903): error C3861: '_InterlockedExchange': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8927): error C3861: '_InterlockedExchangeAdd': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8937): error C3861: '_InterlockedExchangeAdd': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8947): error C3861: '_InterlockedExchangeAdd': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8957): error C3861: '_InterlockedExchangeAdd': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(8992): error C3861: '_InterlockedCompareExchange': identifier not found
1>c:\program files (x86)\windows kits\8.1\include\um\winbase.h(9003): error C3861: '_InterlockedCompareExchange': identifier not found

Aucun commentaire:

Enregistrer un commentaire