简体   繁体   中英

Can't find header file in .lib

I'm working with an Mcp2221, a chip for USB to I2C.

On the Microchip website is a dll to work with the Mcp2221 https://www.microchip.com/wwwproducts/en/MCP2221 I have downloaded the "MCP2221 DLL (v2.2.1)"

In the downloaded zip under unmanaged => lib I copied the mcp2221_dll_um_x64.lib to the directory D:\\createJNIDll

MCP2221 DLL (v2.2.1)\\unmanaged\\lib\\ content:

邮编内容

D:\\createJNIDll\\ content:

在此处输入图片说明

Now I working with Code::Blocks.
I created a new Project and in this Project a file named "main.cpp"

Under Settings => Compiler => Search directories I have added "D:\\createJNIDll\\" to Compiler and Linker.

Under Rightclick on my Project => Build options => Linker settings I have added "D:\\createJNIDll\\mcp2221_dll_um_x64.lib"

My main.cpp looks like this:

#include "mcp2221_dll_um.h"
#include <iostream>

int main(){
    wchar_t* res;
    int i = Mcp2221_GetLibraryVersion(res);
    std::cout << i << ": " << res << std::endl;
}

When I try to build and run the Project I get the Error:

fatal error: mcp2221_dll_um.h: No such file or directory

In the lib directory is a mcp2221_dll_um.h file as you can see in the picture above. So I expected that this header is in the .lib but I'm not 100% sure.

Can anybody help me to fix this problem that I can use the .lib in my project?

So I expected that this header is in the .lib but I'm not 100% sure

What gave you that idea?

The header is a file on disk. You've pointed the linker to the .lib file, but the compiler has no idea where to look for the header. Add that location to your include directories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM