我试图在Windows 10上使ZeroMQ工作,但没有成功。 我已经使用cmake和Visual Studio编译了依赖库,并成功构建了它。
但是,在尝试示例问题时遇到错误,并且意识到存在链接错误,系统无法找到存储的头文件。
我之前曾在这里询问过此问题,该问题已部分解决,但我仍然遇到错误,I get error #include <czmq.h> missing when running program
所以我尝试手动提供gcc的路径,但出现了一些奇怪的错误- 这是我使用的示例代码
#include <czmq.h>
int main (void) {
zsock_t *publisher = zsock_new (ZMQ_PUB);
zsock_set_curve_server (publisher, true);
puts ("Hello, Curve!");
zsock_destroy(&publisher);
return 0;
}
我使用以下方法编译了上面的代码-
gcc hello.c -o myapp -lczmq -lzmq -I "C:\Users\P\go\src\github.com\zeromq\czmq\include" -L "C:\Users\P\go\src\github.com\zeromq\czmq\Debug"
早些时候,我得到了缺少的错误,这是输出。
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\P\go\src\github.com\zeromq\czmq\Debug/czmq.lib when searching for -lczmq
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\P\go\src\github.com\zeromq\czmq\Debug/libczmq.dll when searching for -lczmq
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\P\go\src\github.com\zeromq\czmq\Debug/czmq.lib when searching for -lczmq
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\P\go\src\github.com\zeromq\czmq\Debug/libczmq.dll when searching for -lczmq
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Users\P\go\src\github.com\zeromq\czmq\Debug\czmq.lib when searching for -lczmq
C:/Ruby25-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lczmq
collect2.exe: error: ld returned 1 exit status
所以我被那些无法正常工作的简单事情困住了:( 任何建议都会很有帮助。