C 测试Paillier库时出错:(.text+;0x72):未定义对的引用
我正在尝试使用这个Paillier库,它将只是我试图为Mysql服务器制作的UDF的一部分 这是我的Rakefile中的一部分:C 测试Paillier库时出错:(.text+;0x72):未定义对的引用,c,ruby,rake,paillier,C,Ruby,Rake,Paillier,我正在尝试使用这个Paillier库,它将只是我试图为Mysql服务器制作的UDF的一部分 这是我的Rakefile中的一部分: task :compile do puts 'Compiling the encryption / decryption program.' system("gcc -L/usr/local/lib/ -I/usr/local/include/ -lgmp -lpaillier #{config[:exec_file]}.c -o #{config[:exec
task :compile do
puts 'Compiling the encryption / decryption program.'
system("gcc -L/usr/local/lib/ -I/usr/local/include/ -lgmp -lpaillier #{config[:exec_file]}.c -o #{config[:exec_file]}")
end
但是,我发现了这个错误:
cipher.c:(.text+0x72): undefined reference to `paillier_get_rand_devurandom'
cipher.c:(.text+0x79): undefined reference to `paillier_keygen'
cipher.c:(.text+0x85): undefined reference to `paillier_pubkey_to_hex'
cipher.c:(.text+0x95): undefined reference to `paillier_prvkey_to_hex'
cipher.c:(.text+0xe3): undefined reference to `paillier_freepubkey'
cipher.c:(.text+0xef): undefined reference to `paillier_freeprvkey'
/tmp/ccMPIY0I.o: In function `getKey':
拜托,有人知道问题出在哪里吗
Ps:
exec\u文件
是一个包含paillier.h
的C文件,您可能在gcc调用中的参数顺序有问题。
库应写在源文件和输出文件之后:
gcc -L/usr/local/lib/ -I/usr/local/include/ #{config[:exec_file]}.c -o #{config[:exec_file]} -lgmp -lpaillier
另请参见。thanx对我来说非常有效我更改了源文件和库的顺序,如gcc{config[:exec_file]}.c-o{config[:exec_file]}-lgmp-lpailer-L/usr/local/lib/-i/usr/local/include/,显然在源文件之前放-L是一种不好的做法,这可能会导致链接时出现未定义的引用。是的,对于gcc如何要求其参数,很难形成直觉。很高兴听到链接。是的,谢谢