Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to RestClient::Connection::Connection(std::string const&) #79

Closed
PacoElPirata opened this issue Mar 2, 2017 · 2 comments

Comments

@PacoElPirata
Copy link

Hello everybody!

Expected behaviour

As read in the documentation, it should be possible to create an object (lets say a pointer to an object) of the class connection. For getting that, it is supposed that should be coded the next sencence:
-RestClient::Connection* conn = new RestClient::Connection("http://url.com");

Actual behaviour

When I am trying to build the following program, I get the error in the title of this issue.

#include
#include "connection.h"
#include "restclient.h"

int main(){

RestClient::Response r = RestClient::get("www.google.es");
std::cout << r.code;
RestClient::init();
RestClient::Connection* conn = new RestClient::Connection("www.google.es");
return 0;
}

Environment and debugging details

Eclipse

  • g++ 4.8.4
  • Ubuntu trusty
  • undefined reference to RestClient::Connection::Connection(std::string const&)

The problem is that there is no problem using the RestClient::get method, but however I cannot build any object of the RestClient::Connection class, so I cannot do the request I want.

The request I want to do needs to have a kind of special header, so I cannot do a normal get request to a single url.

Anybody know how could I fix it? I read it in the documentation and I have tried to check in the test, in order to follow the way it is done there, but is not running neither. I have included the path for the headers and added the library -l restclient-cpp, but I am wondering if the fail could be there, and it is not foud because of there is a different library wich contains it.

@mrtazz
Copy link
Owner

mrtazz commented Mar 2, 2017

how are you building your program and how do you get the library (deb or source build)? The include path usually should look something like

#include "restclient-cpp/connection.h"
#include "restclient-cpp/restclient.h"

As the header files are in the restclient-cpp subdirectory. I'm also not sure why RestClient::get works in that setup. So any details about your build workflow would be helpful.

@mrtazz
Copy link
Owner

mrtazz commented Mar 15, 2017

closing this because of no activity, please feel free to reopen if you have additional debug information.

@mrtazz mrtazz closed this as completed Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants