[英]Error after including /usr/include/openssl to project. (Newbie)
I am using Eclipse (2020-06) and CDT on a Fedora desktop and am trying to learn C++.我在 Fedora 桌面上使用 Eclipse (2020-06) 和 CDT,并且正在尝试学习 C++。
In my code, the following lines are compiled without problems:在我的代码中,编译以下几行没有问题:
rc = read(Socket_ID, &ts, BUFSIZ);
if (rc == -1) {
warnx("Reading timestamp failed");
Socket_ID = -1;
}
After adding /usr/include/openssl to the C/C++ build settings, I get this error将 /usr/include/openssl 添加到 C/C++ 构建设置后,出现此错误
error: ‘warnx’ was not declared in this scope
At this moment I even haven't included openssl/md5.h此时我什至还没有包含 openssl/md5.h
After removing the 'warnx'-line, the code compiles without error.删除 'warnx' 行后,代码编译没有错误。
Does this mean that openssl can not be used in a CPP-project or does Eclipse need extra settings?这是否意味着 openssl 不能在 CPP 项目中使用,或者 Eclipse 是否需要额外设置?
Ben本
No it doesn't mean that, but you don't need to add /usr/include/openssl
to your include settings because openssl is already mentioned in不,这并不意味着,但您不需要将
/usr/include/openssl
到您的包含设置中,因为 openssl 已在
#include <openssl/md5.h>
Only if you said只要你说
#include <md5.h>
would you need to have /usr/include/openssl added to your settings.您是否需要将 /usr/include/openssl 添加到您的设置中。
Seems to be quite a common misunderstanding that the 'library' directory has to be mentioned both in the include settings and in the #include
directive, but it's not the case.似乎是一个很常见的误解,即必须在包含设置和
#include
指令中都提到“库”目录,但事实并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.