Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I try to build the following code using MinGW in Eclipse, I get the error "Function 'CreateThreadpool' could not be resolved"

The code:
C++
#define WINVER 0x0603
#define _WIN32_WINNT 0x603
#include <threadpoolapiset.h>
   
int main(void)
{
    CreateThreadpool(nullptr);
    return 0;
}


Note: If I remove the defines for windows version, then I get 2 errors:

1. 'CreateThreadpool' was not declared in this scope
2. Function 'CreateThreadpool' could not be resolved

This means that the defines are making posible for threadpoolapiset.h header to declare the windows API functions.

So back to the initial example, the problem here is that the linker can't find the library where this function is defined.

According to MSDN this function is defined in library kernel32.lib and DLL kernel32.dll.
I found that in MinGW directories the kernel32 library is found as libkernel32.a, so I tryed including paths and libraries in C/C++ Build > Settings | Tab 'Tool Settings' > GCC C++ Compiler > Includes

I tryed including the directory, the library file and both. Also I did this in MinGW C++ Linker > Libraries

Does any one know how can I make it work?
Posted
Comments
Richard MacCutchan 11-Oct-15 4:34am    
Go to the header file where CreateThreadpool Is declared to see why it may be hidden.
victorvg 16-Oct-15 17:26pm    
It is hidden because this directive: "#if _WIN32_WINNT >= 0x0600"
For that I'm using #define _WIN32_WINNT 0x603 but still doesn't work.
Richard MacCutchan 17-Oct-15 4:35am    
There must be something else in the header that is hiding this. You need to look at all preprocessor directives in the header file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900