ShiftMediaProject / gmp

Unofficial GMP with added custom native Visual Studio project build tools. GMP: GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers.
https://gmplib.org/
GNU Lesser General Public License v3.0
85 stars 43 forks source link

I link to a 64bit gmp.lib library,in vs2019 #6

Closed shangsony closed 5 years ago

shangsony commented 5 years ago

Context

Expected Behavior

Actual Behavior

Steps to Reproduce

1>alt_bn128_g1.obj : error LNK2019: unresolved external symbol _gmp_printf referenced in function "public: void thiscall libsnark::alt_bn128_G1::print(void)const " (?print@alt_bn128_G1@libsnark@@QBEXXZ) 1>alt_bn128_g2.obj : error LNK2001: unresolved external symbol _gmp_printf 1>libzsl.obj : error LNK2001: unresolved external symbol ___gmpn_add_n 1>alt_bn128g1.obj : error LNK2001: unresolved external symbol gmpn_add_n 1>alt_bn128_g2.obj : error LNK2001: unresolved external symbol _gmpn_add_n 1>alt_bn128init.obj : error LNK2001: unresolved external symbol gmpn_add_n 1>alt_bn128_pairing.obj : error LNK2001: unresolved external symbol _gmpn_addn 1>libzsl.obj : error LNK2001: unresolved external symbol gmpn_addmul_1 1>alt_bn128_g1.obj : error LNK2001: unresolved external symbol _gmpn_addmul_1 1>alt_bn128g2.obj : error LNK2001: unresolved external symbol gmpn_addmul_1 1>alt_bn128_init.obj : error LNK2001: unresolved external symbol _gmpn_addmul_1 1>alt_bn128pairing.obj : error LNK2001: unresolved external symbol gmpn_addmul_1 1>libzsl.obj : error LNK2001: unresolved external symbol _gmpn_gcdext 1>alt_bn128_g1.obj : error LNK2001: unresolved external symbol _gmpn_gcdext 1>alt_bn128g2.obj : error LNK2001: unresolved external symbol gmpn_gcdext 1>alt_bn128_init.obj : error LNK2001: unresolved external symbol _gmpn_gcdext 1>alt_bn128pairing.obj : error LNK2001: unresolved external symbol gmpn_gcdext 1>libzsl.obj : error LNK2001: unresolved external symbol ___gmpn_mul_n 1>alt_bn128g1.obj : error LNK2001: unresolved external symbol gmpn_mul_n 1>alt_bn128_g2.obj : error LNK2001: unresolved external symbol _gmpn_mul_n 1>alt_bn128init.obj : error LNK2001: unresolved external symbol gmpn_mul_n 1>alt_bn128_pairing.obj : error LNK2001: unresolved external symbol _gmpn_muln 1>libzsl.obj : error LNK2001: unresolved external symbol gmpn_sub_n 1>alt_bn128_g1.obj : error LNK2001: unresolved external symbol _gmpn_sub_n 1>alt_bn128g2.obj : error LNK2001: unresolved external symbol gmpn_sub_n 1>alt_bn128_init.obj : error LNK2001: unresolved external symbol _gmpn_sub_n 1>alt_bn128pairing.obj : error LNK2001: unresolved external symbol gmpn_sub_n 1>libzsl.obj : error LNK2001: unresolved external symbol _gmpn_tdiv_qr 1>alt_bn128g1.obj : error LNK2001: unresolved external symbol gmpn_tdiv_qr 1>alt_bn128_g2.obj : error LNK2001: unresolved external symbol _gmpn_tdiv_qr 1>alt_bn128init.obj : error LNK2001: unresolved external symbol gmpn_tdiv_qr 1>alt_bn128_pairing.obj : error LNK2001: unresolved external symbol _gmpn_tdivqr 1>libzsl.obj : error LNK2001: unresolved external symbol gmpn_copyi 1>alt_bn128_g1.obj : error LNK2001: unresolved external symbol _gmpn_copyi 1>alt_bn128_g2.obj : error LNK2001: unresolved external symbol _gmpn_copyi 1>alt_bn128init.obj : error LNK2001: unresolved external symbol gmpn_copyi 1>alt_bn128_pairing.obj : error LNK2001: unresolved external symbol _gmpncopyi 1>libzsl.obj : error LNK2001: unresolved external symbol gmpn_zero 1>alt_bn128_g1.obj : error LNK2001: unresolved external symbol _gmpn_zero 1>alt_bn128g2.obj : error LNK2001: unresolved external symbol gmpn_zero 1>alt_bn128_init.obj : error LNK2001: unresolved external symbol _gmpn_zero 1>alt_bn128pairing.obj : error LNK2001: unresolved external symbol gmpn_zero 1>alt_bn128_init.obj : error LNK2019: unresolved external symbol _gmpn_set_str referenced in function "public: thiscall libsnark::bigint<4>::bigint<4>(char const *)" (??0?$bigint@$03@libsnark@@QAE@PBD@Z) 1>alt_bn128pairing.obj : error LNK2001: unresolved external symbol gmpn_set_str 1>libzsl.obj : error LNK2019: unresolved external symbol _gmpn_rshift referenced in function "class std::vector<int64,class std::allocator<__int64> > __cdecl libsnark::find_wnaf<4>(unsigned __int64,class libsnark::bigint<4> const &)" (??$find_wnaf@$03@libsnark@@YA?AV?$vector@_JV?$allocator@_J@std@@@std@@_KABV?$bigint@$03@0@@Z) 1>....\build\win32\dbin\gmp.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86' 1>E:\work\bubi\project\test_atl_bn128\zsl\build\win32\dbin\LibZsl.exe : fatal error LNK1120: 11 unresolved externals image image image image

Your Environment

Possible Fix

shangsony commented 5 years ago

why

Sibras commented 5 years ago

Check all your project settings correctly as your clearly compiling in 32bit

E:\work\bubi\project\test_atl_bn128\zsl\build\win32\dbin\LibZsl.exe

note the win32 above.

However this is not the correct location for such user errors as only issues with smp libgmp itself should be listed. Try stack overflow for help with using Visual studio correctly.