visual studio学习250614(编译错误)
背景:使用官网的spi例程(windows的),写参数到ft2232中去;
一、demo编译问题
无法解析的外部符号 __imp__Init_libMPSSE,函数 _main 中引用了该符号
无法解析的外部符号 __imp__Cleanup_libMPSSE,函数 _main 中引用了该符号
无法解析的外部符号 __imp__SPI_GetNumChannels,函数 _main 中引用了该符号
无法解析的外部符号 __imp__SPI_GetChannelInfo,函数 _main 中引用了该符号
无法解析的外部符号 __imp__SPI_OpenChannel,函数 _main 中引用了该符号
无法解析的外部符号 __imp__SPI_InitChannel,函数 _main 中引用了该符号
无法解析的外部符号 __imp__SPI_CloseChannel,函数 _main 中引用了该符号
二、解决办法:
1、程序中要添加:
#ifdef _WIN32
#include <windows.h>
#pragma comment(lib, “FTD2XX.lib”)
#pragma comment(lib, “libMPSSE.lib”)
#else
#include <unistd.h>
#define Sleep sleep
#endif
2、相关的头文件以及lib库添加:
3、并将下面两个库添加到工程的debug目录下(debug目录编译自动生成的):
首先官网下载spi的demo例子程序解压;
https://ftdichip.com/software-examples/mpsse-projects/libmpsse-spi-examples/
其它例子程序:
https://gitcode.com/Universal-Tool/752e3