问题
I am trying from past 4 days to get Zeromq working on my Windows machine but nothings seems to go my way.
I followed given steps and solved few dependcy issues.
I have build libzmq,czmq,libsodium successfully.
I used cmake 3.12 to configure and VS2015 SDK 8.1 to build solution.
I was able to run czmq_selftest.exe however it failed for few things and thats different issue.
But when I try to run basic program myapp.c
#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;
}
I see this missing library issue , I tried given link method-
gcc myapp.c -o myapp -lczmq -lzmq
But nothing is working it would be really helpful if someone can provide some solution.
Here is other info -
OS - Windows 10
Cmake - 3.13.2
Visual Studio 2015, SDK 8.1
libzmq 4.3.0
czmq 4.1.1
Source: https://github.com/zeromq/czmq
More information-
My system-
C:\Users\P\go\src\github.com\zeromq\czmq\include
contains all the libraries.
My program is in -
C:\Users\P\go\src\github.com\zeromq\czmq\examples\security
Thanks
回答1:
The compiler can't keep track of all libraries that a user might have installed on a system by itself. You have to tell the compiler where it can find things like header files or linker-libraries.
To tell the compiler to add a path to the list it uses for searching for header file, use the -I
(upper-case i) option.
To tell the linker to add a path to the list it uses to search for linker-libraries use the -L
option.
Considering the paths you mention in your question and comments you need to add both -I../../include
and -L../../Debug
.
That is, your complete command should look something like
gcc myapp.c -o myapp -I../../include -L../../Debug -lczmq -lzmq
Of course, that requires your to be in the directory C:\Users\P\go\src\github.com\zeromq\czmq\examples\security
as you say.
来源:https://stackoverflow.com/questions/54144527/i-get-error-include-czmq-h-missing-when-running-program