Link error in Mac Xcode

18 views
Skip to first unread message

Matthew Chambers

unread,
Oct 10, 2017, 10:33:09 AM10/10/17
to Google APIs Client Library for C++
I am trying to use the Google APIs C++ Library with a project in Mac Xcode and so far all I'm trying to do is get all the includes and a simple function based the sample code at https://google.github.io/google-api-cpp-client/latest/guide/making_http_requests.html. I have the following source code


#include <iostream>
#include <cstring>

#include <cstdlib>

#include "/Users/mchambers/Downloads/google-api-cpp-client-master/src/googleapis/util/status.h"

#include "/Users/mchambers/Downloads/google-api-cpp-client-master/src/googleapis/client/transport/http_transport.h"

#include "/Users/mchambers/Downloads/google-api-cpp-client-master/src/googleapis/client/transport/http_response.h"

#include "/Users/mchambers/Downloads/google-api-cpp-client-master/src/googleapis/client/transport/http_request.h"

#include "/Users/mchambers/Downloads/google-api-cpp-client-master/src/googleapis/client/data/data_reader.h"


using namespace googleapis;

using namespace std;

using client::HttpRequest;

using client::HttpRequestState;

using client::HttpResponse;

using client::HttpTransport;

using client::HttpTransportLayerConfig;

using client::HttpTransportOptions;


int main(int argc, const char * argv[])

{

    return 0;

}


void http_Get(const char* url, HttpTransport* transport)

{

   shared_ptr<HttpRequest> request(transport->NewHttpRequest(HttpRequest::GET));

   request->set_url(url);

   util::Status status = request->Execute();

   if (!status.ok()) cerr << status.error_message();

}


And I get this error


Undefined symbols for architecture x86_64:
 
"googleapis::client::HttpRequest::GET", referenced from:
      http_Get
(char const*, googleapis::client::HttpTransport*) in main.o
 
"googleapis::client::HttpRequest::Execute()", referenced from:
      http_Get
(char const*, googleapis::client::HttpTransport*) in main.o
ld
: symbol(s) not found for
architecture x86_64


I believe it's somewhere in linking the prebuilt stuff in but I'm new to using Google APIs Client Library (or for that matter any code library outside of .NET in the Microsoft world.


Thanks

Reply all
Reply to author
Forward
0 new messages