I get error #include <czmq.h> missing when running program

限于喜欢 提交于 2019-12-25 02:26:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!