fireice-uk / xmr-stak-cpu

Monero CPU miner
GNU General Public License v3.0
1.11k stars 478 forks source link

VS 15 build error #15

Closed Pamnki closed 7 years ago

Pamnki commented 7 years ago

I'm trying to compile this miner using VS 15 and I'm getting this error. Is there anything I'm missing?

1>jpsock.obj : error LNK2019: unresolved external symbol __imp_closesocket referenced in function "public: void __cdecl jpsock::disconnect(void)" (?disconnect@jpsock@@QEAAXXZ)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_connect referenced in function "private: bool __cdecl jpsock::jpsock_thd_main(void)" (?jpsock_thd_main@jpsock@@AEAA_NXZ)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_recv referenced in function "private: bool __cdecl jpsock::jpsock_thd_main(void)" (?jpsock_thd_main@jpsock@@AEAA_NXZ)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_send referenced in function "private: bool __cdecl jpsock::cmd_ret_wait(char const *,struct jpsock::opq_json_val &)" (?cmd_ret_wait@jpsock@@AEAA_NPEBDAEAUopq_json_val@1@@Z)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_shutdown referenced in function "public: void __cdecl jpsock::disconnect(void)" (?disconnect@jpsock@@QEAAXXZ)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_socket referenced in function "private: bool __cdecl jpsock::prv_connect(char const *)" (?prv_connect@jpsock@@AEAA_NPEBD@Z)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function "public: __cdecl jpsock::jpsock(unsigned __int64)" (??0jpsock@@QEAA@_K@Z)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_WSAGetLastError referenced in function "private: bool __cdecl jpsock::set_socket_error_strerr(char const *)" (?set_socket_error_strerr@jpsock@@AEAA_NPEBD@Z)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_getaddrinfo referenced in function "private: bool __cdecl jpsock::prv_connect(char const *)" (?prv_connect@jpsock@@AEAA_NPEBD@Z)
1>jpsock.obj : error LNK2019: unresolved external symbol __imp_freeaddrinfo referenced in function "private: bool __cdecl jpsock::jpsock_thd_main(void)" (?jpsock_thd_main@jpsock@@AEAA_NXZ)
dimecoin commented 7 years ago

Are you building on Windows 7 ? I was able to build on Windows 7 by using the Windows 8.1 SDK

If not, make sure your linker paths are setup correct. That is, you need to link against the included rapidjson and crypto directories:

C:\dimecoin\projects\xmr-stak-cpu\crypto;C:\dimecoin\projects\xmr-stak-cpu\rapidjson;%(AdditionalLibraryDirectories)
Pamnki commented 7 years ago

Im using Windows 10. I tried to put

D:\Users\PwnK\Downloads\xmr-stak-cpu\crypto;D:\Users\PwnK\Downloads\xmr-stak-cpu\rapidjson;%(AdditionalLibraryDirectories)

to Additional Library Directories but it didn't fix the problem.

dimecoin commented 7 years ago

Did you add files as existing items or as reference?

Pamnki commented 7 years ago

I added the files using File, New, Project From Existing Code and chose Visual C++ and then I just chose the folder location.

dimecoin commented 7 years ago

ah, I see, I just did new project. you also need to link again 'ws2_32.lib'

Pamnki commented 7 years ago

That fixed the problem. Thank you!

fireice-uk commented 7 years ago

dimecoin - rapidjson is all header files, nothing to link against

crypto is c, but msvc will link it as long as it is added to the project.

dimecoin commented 7 years ago

Yea, I was wrong here. Those don't need to be in lib path. Just need to link against 'ws2_32.lib' and it should work.

M-AMAIRI commented 6 years ago

thank you @dimecoin :)