johnson-pkt / twitcurl

Automatically exported from code.google.com/p/twitcurl
0 stars 0 forks source link

Linker Errors when Attempting to Use twitCurl.lib #23

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Downloaded and built twitcurl.lib from source without any problems however when 
I attempt to include this newly built library into a new C++ workspace using 
the same version of Visual Studio (VC++ 2005) I am seeing some Linker errors 
and I am having a hell of a time figuring out why this is happening:

My header file for the Project that is attempting to use these libraries is 
fairly simple:

//INCLUDE twitcurl
#include "twitcurl.h"

//INCLUDE curl
#include "curl/curl.h"
#include "curl/curlbuild.h"
#include "curl/curlrules.h"
#include "curl/curlver.h"
#include "curl/easy.h"
#include "curl/mprintf.h"
#include "curl/multi.h"
#include "curl/stdcheaders.h"

And the .cpp file simply creates and instance of twitCurl:

int main()
{ twitCurl twitterObj; return 0; }

Properties -> Linker -> Input -> Additional Dependencies = 
I:\_Projects\common\libtwitcurl\debug\twitcurl.lib
I:\_Projects\common\libtwitcurl\lib\libcurl.lib

This is what I get when I attempt to build this project:

1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_easy_init referenced in function "public: __thiscall 
twitCurl::twitCurl(void)" (??0twitCurl@@QAE@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_easy_cleanup referenced in function "public: __thiscall 
twitCurl::~twitCurl(void)" (??1twitCurl@@QAE@XZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_easy_setopt referenced in function "private: void __thiscall 
twitCurl::prepareCurlProxy(void)" (?prepareCurlProxy@twitCurl@@AAEXXZ)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_slist_free_all referenced in function "private: bool __thiscall 
twitCurl::performGet(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(?performGet@twitCurl@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocato
r@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_easy_perform referenced in function "private: bool __thiscall 
twitCurl::performGet(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(?performGet@twitCurl@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocato
r@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_slist_append referenced in function "private: bool __thiscall 
twitCurl::performGet(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(?performGet@twitCurl@@AAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocato
r@D@2@@std@@@Z)
1>twitcurl.lib(twitcurl.obj) : error LNK2019: unresolved external symbol 
__imp__curl_easy_getinfo referenced in function "public: bool __thiscall 
twitCurl::oAuthHandlePIN(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(?oAuthHandlePIN@twitCurl@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allo
cator@D@2@@std@@@Z)
1>D:\Projects VS05\TestTwitterAPI\Debug\TestTwitterAPI.exe : fatal error 
LNK1120: 7 unresolved externals 

I am stuck on this and it is extremely frustrating!

Original issue reported on code.google.com by cesar...@gmail.com on 29 Nov 2011 at 7:38

GoogleCodeExporter commented 8 years ago
These are the same errors I get when I checkout the twitterClient solution and 
attempt to convert it to VC++ 2005, the same 7 curl linking errors for the same 
symbols.

Am I missing a library somewhere?

Original comment by cesar...@gmail.com on 29 Nov 2011 at 10:37

GoogleCodeExporter commented 8 years ago
Built CUrl from source and used the static library that resulted from that 
successful build, and I am still seeing the same Linking errors any help or 
point in the right direction would be greatly appreciated.

Original comment by cesar...@gmail.com on 30 Nov 2011 at 5:26

GoogleCodeExporter commented 8 years ago
Building the Solution in VC++ 6 doesn't do any better. The same 7 functions are 
improperly linked:  

twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_easy_init
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_easy_cleanup
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_easy_setopt
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_slist_free_all
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_easy_perform
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_slist_append
twitcurl.lib(twitcurl.obj) : error LNK2001: unresolved external symbol 
__imp__curl_easy_getinfo

Any word on how I can fix this, and use this API in my project?

Original comment by cesar...@gmail.com on 1 Dec 2011 at 4:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I fixed this issue by downloading CUrl source and including it in my
project instead of Linking CUrl, and this corrected the issue.

Original comment by cesar...@gmail.com on 13 Mar 2012 at 8:47

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If your problems are related to Debug config, try to add CURL_STATICLIB 
proprocessor macro for twitCurl project (debug config)

Original comment by jkra...@gmail.com on 13 Mar 2012 at 8:57

GoogleCodeExporter commented 8 years ago
@cesareof 

I have the exact same issue. What do you mean you downloaded the curl source? I 
downloaded the files using an SVN program and I link it into my project. How 
did you include it directly into your project?

Thanks

Original comment by bie...@student.breckschool.org on 31 Jul 2012 at 6:03

GoogleCodeExporter commented 8 years ago
CUrl is the code I needed to download so I could add it to my project: 
Project->Properties->Linker->Input->Additional Dependencies 
and add the libcurl_imp.lib there.

Right click on your project in Visual Studio and select Add -> Existing Item 
and select the headers and cpp files that make up the twitcurl source. 

This is just a workaround that I had to employ in order to get this project to 
work so I could update pragmatically update a given Twitter feed. 

Original comment by cesar...@gmail.com on 31 Jul 2012 at 8:48

GoogleCodeExporter commented 8 years ago
All I have is libcurl.lib. Where can I find libcurl_imp.lib?

Original comment by bie...@student.breckschool.org on 31 Jul 2012 at 9:55

GoogleCodeExporter commented 8 years ago
Download the curl project and do a static build of that project and use the
resulting library to include it in your project

Original comment by cesar...@gmail.com on 31 Jul 2012 at 10:51

GoogleCodeExporter commented 8 years ago
I'm sorry. I'm still sort of new to programming, but what is the curl project? 
Do you mean the curl source on this google code page? Or are you referencing a 
separate page?

Original comment by bie...@student.breckschool.org on 1 Aug 2012 at 1:12

GoogleCodeExporter commented 8 years ago
Ok so I was able to get the libcurl_imp.lib, and I included it like you said, 
but I'm still getting the same errors. I also added the existing cpp's and h's 
to my project. I included them from the libtwitcurl folder, but I didn't go 
into any sub folders, should I be adding these files from somewhere else? 

Original comment by bie...@student.breckschool.org on 1 Aug 2012 at 2:33

GoogleCodeExporter commented 8 years ago
I attached a quick VS2005 Project that I created using this techinique that 
builds properly and works using the twitcurl API. 

Original comment by cesar...@gmail.com on 1 Aug 2012 at 8:07

Attachments:

GoogleCodeExporter commented 8 years ago
Hello, 
I built x64 lib for openssl ( as static library ), libcurl ( also static 
library ) and twitcurl library. And with the included twitterClient sample 
project, it throws the same errors people mentioned.

So, I went back to x86 version and built the twitcurl library as is. And in the 
twitterClient sample project, there is already a prebuilt twitcurl library.
But that project also threw the same error messages.

Did someone try to solve this problem properly? I checked the libcurl, openssl 
library to see if there is anything wrong but there was no such thing.

in the twitcurl library, I didn't find anything special.
Thanks,

Original comment by jongamp...@gmail.com on 30 Jun 2014 at 5:00

GoogleCodeExporter commented 8 years ago
BTW, I used Visual Studio 2010.

Original comment by jongamp...@gmail.com on 30 Jun 2014 at 5:00

GoogleCodeExporter commented 8 years ago
Looks to be related to this issue : 
https://code.google.com/p/twitcurl/issues/detail?can=2&start=0&num=100&q=&colspe
c=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=
40

Original comment by jongamp...@gmail.com on 30 Jun 2014 at 7:41

GoogleCodeExporter commented 8 years ago
There were other kind of LNK2019 errors.
Even with "as is" twitterClient sample project, it complaint like :

std::allocator<char> > &,class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> >)" 
(?search@twitCurl@@QEAA_NAEAV?

It looks not to have added std::string stuff properly.
I know that /Zl option can be involved, but there was not such option.

How to go around this problem?
just add the source code of twitcurl library to your host project. And link 
libcurl_a.lib (static) libcurl.lib ( stub file to its DLL file ).

Original comment by jongamp...@gmail.com on 30 Jun 2014 at 7:49