未定义对“ hostGetByName” VxWorks的引用

问题描述

我正在尝试编译一个简单的vxworks RTP应用程序。我正在获取对“ hostGetByName”的未定义引用。根据文档,此功能应该在用户空间中可用,并且在VSB中已包含必要的层“ IPNET_USRSPACE”,但仍然出现错误。有什么想法我想念吗?

    /* includes */

#include <stdio.h>
#include <hostLib.h>
#include <sockLib.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>

int main (
    int    argc,/* number of arguments */
    char * argv[]   /* array of arguments */
    ) {
    
    
    
    char *inGroup;
    int host;
    
    host = hostGetByName(inGroup);

    return 0;
}

对“ hostGetByName”的未定义引用

解决方法

看起来链接程序没有选择网络库。

-lnet将完成工作。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...