0

*Note: I'm very new to coding (as in I'm following online tutorials to try to learn the basics of C++ and trying to build my first application for a demo fair).

I'm building an application that allows a device to access Twitter and send tweets after commands are executed. To help, I'm using a C++ code library from github that has a bunch of the code ready.

When I went to compile what I have so far, I got an error for what looks like a class object that is initialized in a header file: "undefined reference to 'twitcurl::twitCurl()'".

Here's where I'm getting the error (in .cpp):

twitCurl twitterObj;
std::string tmpStr, tmpStr2;
std::string replyMsg;
char tmpBuf[1024];

And here's the first part of the class definition (in .h):

class twitCurl
{
public:
    twitCurl();
    ~twitCurl();

    /* Twitter OAuth authorization methods */
    oAuth& getOAuth();
    bool oAuthRequestToken( std::string& authorizeUrl /* out */ );
    bool oAuthAccessToken();
    bool oAuthHandlePIN( const std::string& authorizeUrl /* in */ );

I have the header file included, so I'm not sure why it's erroring as undefined, unless there is something I need to do in the header files.

Any help is greatly appreciated!

Thanks!

  • You need to provide implementations for those functions, otherwise your computer doesn't know what to do when you call them... – Lightness Races in Orbit Sep 21 '15 at 16:41
  • You have to do more than just include the header file. You also have to tell the linker to use the library containing the twitCurl object code. The linked answer explains some of this and the information should be sufficient enough for you to move forward, even if just a little bit. – Captain Obvlious Sep 22 '15 at 15:54
  • Okay. Thanks for your help! –  Sep 22 '15 at 15:59

0 Answers0