gpt4 book ai didi

c - 链接库

转载 作者:太空狗 更新时间:2023-10-29 11:34:28 27 4
gpt4 key购买 nike

我刚刚开始 Linux 编程。我正在尝试编译一个名为“spider”的程序来搜索某种类型的正则表达式。所需的库是 PCRE、OpenSSL 和 libexpat。我安装了这些库,但出于某种原因它们没有链接。

spider.c: In function ‘craft_csv_entry’:
spider.c:1261: warning: format ‘%lld’ expects type ‘long long int’, but argument 4 has type ‘__off_t’
spider.c:1261: warning: format ‘%lld’ expects type ‘long long int’, but argument 4 has type ‘__off_t’
spider.c: In function ‘read_maxgroups’:
spider.c:2218: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘XML_Size’
/tmp/ccZ2CUHF.o: In function `main':
spider.c:(.text+0xd2): undefined reference to `pcre_callout'
/tmp/ccZ2CUHF.o: In function `load_regexes':
spider.c:(.text+0x3db): undefined reference to `pcre_compile'
spider.c:(.text+0x440): undefined reference to `pcre_study'
/tmp/ccZ2CUHF.o: In function `compile_regexes':
spider.c:(.text+0x4d3): undefined reference to `pcre_compile'
spider.c:(.text+0x4f5): undefined reference to `pcre_study'
spider.c:(.text+0x52f): undefined reference to `pcre_compile'
spider.c:(.text+0x551): undefined reference to `pcre_study'
spider.c:(.text+0x58b): undefined reference to `pcre_compile'
spider.c:(.text+0x5ad): undefined reference to `pcre_study'
/tmp/ccZ2CUHF.o: In function `is_match':
spider.c:(.text+0xad2): undefined reference to `pcre_exec'
spider.c:(.text+0xb6e): undefined reference to `pcre_exec'
spider.c:(.text+0xc0a): undefined reference to `pcre_exec'
spider.c:(.text+0xcbc): undefined reference to `pcre_exec'
/tmp/ccZ2CUHF.o: In function `set_globals':
spider.c:(.text+0x1e95): undefined reference to `log'
spider.c:(.text+0x1ed1): undefined reference to `pow'
/tmp/ccZ2CUHF.o: In function `craft_csv_entry':
spider.c:(.text+0x21fa): undefined reference to `MD5_Init'
spider.c:(.text+0x225d): undefined reference to `MD5_Update'
spider.c:(.text+0x22b2): undefined reference to `MD5_Final'
/tmp/ccZ2CUHF.o: In function `read_maxgroups':
spider.c:(.text+0x4498): undefined reference to `XML_ParserCreateNS'
spider.c:(.text+0x4513): undefined reference to `XML_SetUserData'
spider.c:(.text+0x452e): undefined reference to `XML_SetElementHandler'
spider.c:(.text+0x4549): undefined reference to `XML_SetNamespaceDeclHandler'
spider.c:(.text+0x45b6): undefined reference to `XML_GetBuffer'
spider.c:(.text+0x466a): undefined reference to `XML_ParseBuffer'
spider.c:(.text+0x4679): undefined reference to `XML_GetErrorCode'
spider.c:(.text+0x4681): undefined reference to `XML_ErrorString'
spider.c:(.text+0x468e): undefined reference to `XML_GetCurrentLineNumber'
/tmp/ccZ2CUHF.o: In function `spider_encrypt':
spider.c:(.text+0x491c): undefined reference to `EVP_CIPHER_CTX_init'
spider.c:(.text+0x4921): undefined reference to `EVP_bf_cbc'
spider.c:(.text+0x4943): undefined reference to `EVP_EncryptInit'
spider.c:(.text+0x499d): undefined reference to `EVP_EncryptUpdate'
spider.c:(.text+0x4a2e): undefined reference to `EVP_EncryptFinal'
spider.c:(.text+0x4a81): undefined reference to `EVP_CIPHER_CTX_cleanup'
/tmp/ccZ2CUHF.o: In function `spider_decrypt':
spider.c:(.text+0x4b82): undefined reference to `EVP_CIPHER_CTX_init'
spider.c:(.text+0x4b87): undefined reference to `EVP_bf_cbc'
spider.c:(.text+0x4ba9): undefined reference to `EVP_DecryptInit'
spider.c:(.text+0x4be4): undefined reference to `EVP_DecryptUpdate'
spider.c:(.text+0x4c9d): undefined reference to `EVP_DecryptFinal'
spider.c:(.text+0x4d26): undefined reference to `EVP_CIPHER_CTX_cleanup'
collect2: ld returned 1 exit status

最佳答案

试试这个:

gcc -o spider spider.c -I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib -lpcre -lssl -lcrypto -lexpat

关于c - 链接库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5605080/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com