我正在开发一个 C++ 项目,该项目利用 ZeroMQ 库与 Python 和 MetaTrader 4 (MT4) 进行通信。我正在 Windows 上使用 VSCode 和 MinGW-w64 作为编译器设置我的开发环境。
到目前为止我已采取的步骤:
1。克隆 cppzmq 存储库:
git clone https://github.com/zeromq/cppzmq.git
2.创建ZeroMQ包含文件的目录:
mkdir C:\ZeroMQ\include\cppzmq
3.将zmq.hpp文件复制到包含目录:
Copy-Item "C:\Users\Leonardo Alves\Desktop\Python Projects\project_socket\cppzmq\zmq.hpp" "C:\ZeroMQ\include\cppzmq\"
4.在VSCode中配置tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build DLL (Debug)",
"type": "shell",
"command": "g++",
"args": [
"-shared",
"-o", "output/mq4socket.dll",
"mq4socket.cpp",
"-I", "C:/ZeroMQ/include",
"-L", "C:/ZeroMQ/lib",
"-lzmq",
"-g"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"]
},
{
"label": "Build Test App (Debug)",
"type": "shell",
"command": "g++",
"args": [
"-o", "output/test_app.exe",
"test_app.cpp",
"-I", "C:/ZeroMQ/include",
"-L", "C:/ZeroMQ/lib",
"-lzmq",
"-g"
],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": ["$gcc"]
}
]
}
5.在VSCode中配置c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:/ZeroMQ/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/mingw64/bin/g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
问题:
尝试编译 mq4socket.cpp 代码时,我收到以下错误:
c:\Users\Leonardo Alves\Desktop\Python Projects\project_socket\mq4socket.cpp:3:10: fatal error: zmq.hpp: No such file or directory
3 | #include <zmq.hpp>
| ^~~~~~~~~
compilation terminated.
我检查过的内容: