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

Linker Errors when Attempting to Use twitCurl.lib #23

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 18 comments
Open

Linker Errors when Attempting to Use twitCurl.lib #23

GoogleCodeExporter opened this issue Mar 15, 2015 · 18 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 29 Nov 2011 at 7:38

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 29 Nov 2011 at 10:37

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 30 Nov 2011 at 5:26

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 1 Dec 2011 at 4:48

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 13 Mar 2012 at 8:47

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

If your problems are related to Debug config, try to add CURL_STATICLIB 
proprocessor macro for twitCurl project (debug config)

Original comment by [email protected] on 13 Mar 2012 at 8:57

@GoogleCodeExporter
Copy link
Author

@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 [email protected] on 31 Jul 2012 at 6:03

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 31 Jul 2012 at 8:48

@GoogleCodeExporter
Copy link
Author

All I have is libcurl.lib. Where can I find libcurl_imp.lib?

Original comment by [email protected] on 31 Jul 2012 at 9:55

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 31 Jul 2012 at 10:51

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 1 Aug 2012 at 1:12

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 1 Aug 2012 at 2:33

@GoogleCodeExporter
Copy link
Author

I attached a quick VS2005 Project that I created using this techinique that 
builds properly and works using the twitcurl API. 

Original comment by [email protected] on 1 Aug 2012 at 8:07

Attachments:

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 30 Jun 2014 at 5:00

@GoogleCodeExporter
Copy link
Author

BTW, I used Visual Studio 2010.

Original comment by [email protected] on 30 Jun 2014 at 5:00

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 30 Jun 2014 at 7:41

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 30 Jun 2014 at 7:49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant