HttpClient - unresolved external Windows VC++

Hi all,

platform - windows
IDE - VC++ 2012

I have this linkerror

error LNK2019: unresolved external symbol “public: static class cocos2d::network::HttpClient * __cdecl cocos2d::network::HttpClient::getInstance(void)” (?getInstance@HttpClient@network@cocos2d@@SAPAV123@XZ) referenced in function “public: void __thiscall Game::ExtractLevelFromFile(char *)”

i included the network proj to my solution, i also tried adding libnetwork.lib to properties->linker->input->additional dependencies, but no help the error persist.

all helps are highly appreciated

Can you look in your compiler output, if the lib is getting linked?

May it’s not found. In that case at the path to AdditionalLibraryDirectories.

i added already but still it wasnt working. Anyhow i fixed the error by adding libcurl_imp.lib to my additional directories.

I am also getting the same linker error
I tried to include libcurl_imp.lib too, but no change
ps I am using cocos2d-x 3.2.

Did you also link it?

Look at your linker output to make sure it’s in your lib path and you are linking to it for your target.

there is no obj file for network or httpclient in debug folder
how to add it to lib path and link?

You need to link to the curl implementation lib:

external\curl\prebuilt\win32\libcurl_imp.lib

Depends on your IDE.

1 Like

Thanks! it works
I added whole libnetwork project to my game dependencies. and it resolved the issue.

@iQD Getting same issue in eclipse
any help please

Link the libs in external\curl\prebuilt\android

Does linking mean include source to it in build path?
if it so then I did it but no effect.

No. Linking means adding the path of the lib to your library path setting in Eclipse and adding the library to the library setting.

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_pns_libpath.htm

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_pns_lib.htm&cp=9_4_7_1_2_0_2

I added the path
“D:\Mobile\cocosspace\shipgame2\cocos2d\external\curl\prebuilt\android”
to library paths but no difference.

Cause you also have to add the lib. See the second link.


@iQD what i am doing wrong?

In Library Paths you only add the path where the lib resides. The issue is, that you are not adding it as an absolute or relative path. Don’t add anything like include files ore paths to source code.

If you have set an environment variable COCOS2DX to your cocos2d-x root directory and you are compiling for armabi, you would add: ${COCOS2DX}\external\curl\prebuilt\android\armeabi

In Libraries you set the libs to link with, but without the lib prefix and any extension: curl

1 Like

its better to use cocos command than eclipse, do your dev in VC++ or Xcode and run your app in android using cocos command.

1 Like

@BilalHaider glad to know that you fixed that!
I have a same problem with libGUI, I added the whole libGUI project to my game dependencies (msvs2010), but still get the same linker error :frowning:

@iQD @BilalHaider can you please take a look [SOLVED] MSVS 2010 linker error LNK2019 while using ui components (ui::ScrollView)

Regards,
Mike.

1 Like

Seems, that you already solved it.

1 Like