1、首先保证你的.pro里面正确导入了QCustomPlot ,还有 QT+=printsupport
2、博主这边出现的问题是调用了#include <winsock2.h>#include <ws2tcpip.h>#include <iostream> 这三个头文件,然后在别的头文件中去调用qcustomplot.h。
总结:这里有一个因为qcustomplot.h里面有windows.h会和winsock2.h相互冲突。在调用qcustomplot.h前面加个宏定义#define _WINSOCKAPI_ 就可以了。