编译器无法识别GMP构造函数?

时间:2017-10-29 23:42:14

标签: c++ gmp

#include <stdio.h>
#include <iostream>
#include <fstream>
#include <gmp.h>

int main(int argc, char **argv)
{
    std::string input_name = argv[1];
    std::ifstream input;
    input.open(input_name.c_str());

    std::string line;
    while (input >> line)
    {
        std::cout << line << std::endl;
        mpz_t test(line, 16);
    }

    input.close();
    return 0;
}

当我尝试编译这段代码时,我收到以下错误:

error: expression list treated as compound expression in initializer [-fpermissive]
         mpz_t test(line, 16);
                            ^
warning: left operand of comma operator has no effect [-Wunused-value]
error: array must be initialized with a brace-enclosed initializer
warning: unused variable 'test' [-Wunused-variable]
         mpz_t test(line, 16);
               ^

可能有什么不对?我使用-lgmp链接器选项和我尝试过的函数(即mpz_init被识别没有问题)。

0 个答案:

没有答案