0
尝试编译我使用GMP的代码时出现此错误。有什么办法可以解决这个问题吗?即时通讯使用Visual Studio 2010的命令提示符下进行编译,这是我用过的命令:使用gmp编译时出错
CL testing.c gmp.lib
int main(void)
{
mpz_t a,b;
mpz_init(b);
mpz_init(a);
gmp_randstate_t rstate; // the problem arises when declaring this
}
testing.c
testing.c(9) : error C2275: 'gmp_randstate_t' : illegal use of this type as an e
xpression
c:\cygwin\home\administrator\ss\gmp.h(252) : see declaration of 'gmp_ran
dstate_t'
testing.c(9) : error C2146: syntax error : missing ';' before identifier 'state'
testing.c(9) : error C2065: 'state' : undeclared identifier
testing.c(11) : error C2065: 'state' : undeclared identifier
testing.c(11) : warning C4047: 'function' : '__gmp_randstate_struct *' differs i
n levels of indirection from 'int'
testing.c(11) : warning C4024: '__gmp_randinit_default' : different types for fo
rmal and actual parameter 1
testing.c(13) : error C2065: 'state' : undeclared identifier
testing.c(13) : warning C4047: 'function' : '__gmp_randstate_struct *' differs i
n levels of indirection from 'int'
testing.c(13) : warning C4024: '__gmpz_urandomb' : different types for formal an
d actual parameter 2
testing.c(14) : error C2065: 'state' : undeclared identifier
testing.c(14) : warning C4047: 'function' : '__gmp_randstate_struct *' differs i
n levels of indirection from 'int'
testing.c(14) : warning C4024: '__gmpz_urandomb' : different types for formal an
d actual parameter 2
你应该包括你的实际代码。 –
为什么在cygwin下使用头文件来编译VC++? –
已添加源代码,它被放置在cygwin文件夹中作为临时文件。它对代码没有影响,即使我把它移出了cygwin文件夹 – user1758596