main.cpp
#include "Variables.h"
using namespace std;
int main()
{
setlocale(LC_ALL, "rus");
ifstream fin(book_name);
copy(istream_iterator<string>(fin), istream_iterator<string>(),\
back_inserter(book_text));
twitterObj.setTwitterUsername(userName);
twitterObj.setTwitterPassword(passWord);
twitterObj.getOAuth().setConsumerKey(APIConsumerKey);
twitterObj.getOAuth().setConsumerSecret(APIConsumerSecretKey);
twitterObj.getOAuth().setOAuthTokenKey(myOAuthAccessTokenKey);
twitterObj.getOAuth().setOAuthTokenSecret(myOAuthAccessTokenSecret);
twitterObj.oAuthRequestToken(Authorize_URL);
twitterObj.oAuthAccessToken();
twitterObj.oAuthHandlePIN(Authorize_URL);
twitterObj.oAuthAccessToken();
twitterObj.getOAuth().getOAuthTokenKey(myOAuthAccessTokenKey);
twitterObj.getOAuth().getOAuthTokenSecret(myOAuthAccessTokenSecret);
/*All this magic*/
for (auto it = book_text.begin(); it != book_text.end(); ++it)
{
word = *it;
count_word += word.size();
if ((count_word >= 110) || (word[word.size() - 1] == '.'))
stop_recording = true;
TWITT.push_back(word);
if (stop_recording == true)
{
//Sleep(StepTime);//step whis one hours
copy(TWITT.begin(), TWITT.end(), \
ostream_iterator<string>(cout, " "));
TWITT.clear();
stop_recording = false;
cout << "{" << count_word << "}"\
<< endl;
cout << endl << "---------------------------------------"\
<< "---------------------------------------"\
<< endl;
count_word = 0;
}
return 0;
}
}
Variables.h
#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
#include <dos.h>
#include "twitterClient/include/oauthlib.h"
#include "twitterClient/include/twitcurl.h"
#include "twitterClient/twitterClient.h"
using namespace twitCurlTypes;
/*blue variables*/
unsigned int count_word = 0, count = 0;
unsigned long long StepTime = 1200 * 60;
bool stop_recording = false;
char tmpBuf[1024];
/*green variables*/
std::string word;
std::string book_name = "WarAndPeace.txt";
std::vector<std::string> book_text, TWITT;
std::string userName("Username");
std::string passWord("password");
std::string tmpStr, replyMsg;
std::string myOAuthAccessTokenKey("739431278752243712-XYOwFd5upQF3LYVNlzdT3gBVFVEFxnG");
std::string myOAuthAccessTokenSecret("saJ8K7QydWAWXqnMX2fULUD3kV0FpgL0E66s7QfQUJ99U");
std::string APIConsumerKey("7IuxqRSTXDuX10m5SqODWZUEQ");
std::string APIConsumerSecretKey("9LxNQg6pxfC1c7NdnawWW0UWugjs80GcLfrYluSg6rg6ZBPSOy");
std::string Authorize_URL("https://api.twitter.com/oauth/authorize");
std::string RequestToken_URL("https ://api.twitter.com/oauth/request_token");
std::string AccessToken_URL("https ://api.twitter.com/oauth/access_token");
twitCurl twitterObj;
Лог:
Ошибка LNK2019 ссылка на неразрешенный внешний символ "public: void __thiscall oAuth::setConsumerKey(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?setConsumerKey@oAuth@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) в функции _main War_and_peace D:\проекты\War_and_peace\War_and_peace\main.obj 1
Может кто сказать где ошибка и как ее исправить.
ссылка на неразрешенный внешний символ "public: void __thiscall oAuth::setConsumerKey. Что делать - линковать с нужной библиотекой (так ли это на самом деле в вашей мешанине буковок не понять). – PinkTux Jun 15 '16 at 14:51