ОС Asplinux ,ide KDevelop
#include
#include
#include "curl/curl.h"
using namespace std;
static char errorBuffer[CURL_ERROR_SIZE];
static string buffer;
static int writer(char *data, size_t size, size_t nmemb,
std::string *buffer)
{
int result = 0;
if (buffer != NULL)
{
buffer->append(data, size * nmemb);
result = size * nmemb;
}
return result;
}
// You know what this does..
void usage()
{
cout << "curltest: \n" << endl;
cout << " Usage: curltest url\n" << endl;
}
int main(int argc, char* argv[])
{
if (argc > 1)
{
string url(argv[1]);
cout << "Retrieving " << url << endl;
// Our curl objects
CURL *curl;
CURLcode result;
// Create our curl handle
curl = curl_easy_init();
if (curl)
{
// Now set up all of the curl options
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
// Attempt to retrieve the remote page
result = curl_easy_perform(curl);
// Always cleanup
curl_easy_cleanup(curl);
// Did we succeed?
if (result == CURLE_OK)
{
cout << buffer << "\n";
exit(0);
}
else
{
cout << "Error: [" << result << "] - " << errorBuffer;
exit(-1);
}
}
}
}
cd '/home/sneg/tt' && QTDIR="/usr/lib/qt-3.3" PATH=$QTDIR/bin:$PATH LC_MESSAGES="C" LC_CTYPE="C" gmake -k cd src && gmake -f Makefile compiling tt.cpp (g++) test -d ../bin/ || mkdir -p ../bin/ linking ../bin/tt (g++) tt.o: In function `main': /home/sneg/tt/src/tt.cpp:66: undefined reference to `curl_easy_init' /home/sneg/tt/src/tt.cpp:71: undefined reference to `curl_easy_setopt' /home/sneg/tt/src/tt.cpp:72: undefined reference to `curl_easy_setopt' /home/sneg/tt/src/tt.cpp:73: undefined reference to `curl_easy_setopt' /home/sneg/tt/src/tt.cpp:74: undefined reference to `curl_easy_setopt' /home/sneg/tt/src/tt.cpp:75: undefined reference to `curl_easy_setopt' tt.o:/home/sneg/tt/src/tt.cpp:76: more undefined references to `curl_easy_setopt' follow tt.o: In function `main': /home/sneg/tt/src/tt.cpp:79: undefined reference to `curl_easy_perform' /home/sneg/tt/src/tt.cpp:82: undefined reference to `curl_easy_cleanup' collect2: ld returned 1 exit status gmake[1]: *** [../bin/tt] Error 1 gmake[1]: Target `first' not remade because of errors. gmake: *** [sub-src] Error 2 gmake: Target `first' not remade because of errors. *** Exited with status: 2 ***
как правильно настроить KDevelop чтобы видел curl ?