Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C g++;用于体系结构x86_64的未定义符号_C_Macos_Curl_Gcc_Libcurl - Fatal编程技术网

C g++;用于体系结构x86_64的未定义符号

C g++;用于体系结构x86_64的未定义符号,c,macos,curl,gcc,libcurl,C,Macos,Curl,Gcc,Libcurl,我正在学习一门有关卷曲的在线课程。然而,我遇到了一些问题 我的建筑声明是: gcc -Wall web-server.c -o web-server1 -lcurl 这是webserver.c中的代码 #include <stdio.h> #include <stdlib.h> #include <curl/curl.h> int main(void){ CURL *curl = NULL; CURLcode res; curl =

我正在学习一门有关卷曲的在线课程。然而,我遇到了一些问题

我的建筑声明是:

gcc -Wall web-server.c -o web-server1 -lcurl
这是webserver.c中的代码

#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
int main(void){
    CURL *curl = NULL;
    CURLcode res;

    curl = curl_easy_init();

    curl_easy_setops(curl, CURLOPT_URL, "http://www.google.com");


    res = curl_easy_perform(curl);
    if (res != CURLE_OK){
        print("curl easy perform error res = %d",res);
        return 1;
    }

    curl_easy_cleanup(curl);
    return 0;
}

非常感谢你们 我的操作系统是MacOs 10.14.6 我的gcc版本

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown
详细错误消息

 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library 
/Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -
dynamic -arch x86_64 -macosx_version_min 10.14.0 -o web-server 
/var/folders/j2/jrqt57vj73s0jc8mjc2mddf40000gn/T/web-server-14b13c.o -lcurl 
-lSystem 
/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/lib/darwin/libclan
g_rt.osx.a

我很惊讶你得到一个链接器错误,
curl\u easy\u setops
不存在。这是一个输入错误,您正在寻找
curl\u easy\u setop
,它不会以s@hanshenrik非常感谢。在更正了这个类型错误之后,我可以运行我的代码。但是您知道如何处理链接器错误吗?当我安装libevent时,它无法生成x86_64 libssl.a什么链接器错误?我很惊讶您会收到链接器错误,
curl\u easy\u setops
不存在。这是一个输入错误,您正在寻找
curl\u easy\u setop
,它不会以s@hanshenrik非常感谢。在更正了这个类型错误之后,我可以运行我的代码。但是您知道如何处理链接器错误吗?安装libevent时,它无法生成x86_64 libssl.a什么链接器错误?
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library 
/Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -
dynamic -arch x86_64 -macosx_version_min 10.14.0 -o web-server 
/var/folders/j2/jrqt57vj73s0jc8mjc2mddf40000gn/T/web-server-14b13c.o -lcurl 
-lSystem 
/Library/Developer/CommandLineTools/usr/lib/clang/10.0.1/lib/darwin/libclan
g_rt.osx.a