​​ ​

The AppleCare Support Community will permanently close on November 20, 2026. Starting today, the site will no longer accept new posts and is available in a read-only state.


You can continue to find trusted guidance and support on the official Apple Support site. 


We want to thank the community members who have contributed their time and expertise to help others with their Apple products.


Undefined symbols for architecture x86_64

I'm trying to run following code in mac os x mount lion (64 bit) but the curl library is not designed for same.

Please help how can i run this


C++ Application Code


#include <iostream>

#include <string>

#include <curl/curl.h>

#include <stdio.h>

size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {

size_t written;

written = fwrite(ptr, size, nmemb, stream);

return written;

}


int main() {

std::string tempname = "temp";

CURL *curl;

CURLcode res;

curl = curl_easy_init();

if(curl) {

FILE *fp = fopen(tempname.c_str(),"wb");

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

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);

curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);

res = curl_easy_perform(curl);

curl_easy_cleanup(curl);

fclose(fp);

fp = fopen(tempname.c_str(),"rb");

fseek (fp , 0 , SEEK_END);

long lSize = ftell (fp);

rewind(fp);

char *buffer = new char[lSize+1];

fread (buffer, 1, lSize, fp);

buffer[lSize] = 0;

fclose(fp);

std::string content(buffer);

delete [] buffer;

}

}


Error:


Undefined symbols for architecture x86_64:

"_curl_easy_cleanup", referenced from:

_main in main.o

"_curl_easy_init", referenced from:

_main in main.o

"_curl_easy_perform", referenced from:

_main in main.o

"_curl_easy_setopt", referenced from:

_main in main.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Posted on Jan 25, 2013 1:46 AM

9 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Undefined symbols for architecture x86_64

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.