简体   繁体   English

在 Windows 10 上成功安装后,如何让 VSCode 找到 gmp.h?

[英]How can I get VSCode to find gmp.h after it has been successfully installed on Windows 10?

After installing and following the instructions for GMP (using mingw64 since I am on windows) and verifying the installation was correct using make check I tried running the following code in VSCode using the command g++ -g \\path\\file.cpp -lgmpxx -lgmp -o \\path\\file.exe :安装并遵循GMP的说明(使用 mingw64,因为我在 Windows 上)并使用make check验证安装正确后,我尝试使用命令g++ -g \\path\\file.cpp -lgmpxx -lgmp -o \\path\\file.exe在 VSCode 中运行以下代码g++ -g \\path\\file.cpp -lgmpxx -lgmp -o \\path\\file.exe

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

using namespace std;

int main()
{
    mpz_class a,b,c;
    cout << "Hello World\n";
    a = 1234;
    b = "5678";
    c = a+b;
    return 0;
}

But get the error error: 'mpz_class' was not declared in this scope .但是得到错误error: 'mpz_class' was not declared in this scope So the include path in VSCode is incorrectly set up or the installation was messed up.所以VSCode中的include路径设置不正确或者安装乱了。 I am wondering how to fix this: is this VSCode's includePath (compilerPath is not set up), an installation issue (I could not determine the default install location for windows systems since everything I found was for Linux), or is there something else I missed?我想知道如何解决这个问题:这是 VSCode 的 includePath(未设置 compilerPath)、安装问题(我无法确定 Windows 系统的默认安装位置,因为我发现的所有内容都是针对 Linux 的),或者还有其他问题吗?错过了? I saw a flag for ./configure that was --enable-cxx but I wanted to ask before running make clean and retrying with that flag turned on since it takes forever.我看到./configure的标志是--enable-cxx但我想在运行make clean之前询问并在打开该标志的情况下重试,因为它需要永远。

I feel like this is something dead simple since I cannot find any help from googling.我觉得这很简单,因为我无法从谷歌搜索中找到任何帮助。

Thank you for any help!感谢您的任何帮助!

EDIT: I have tried running the code not in VSCode and it still has the same issue so I am not so sure it's VSCode.编辑:我试过运行不在 VSCode 中的代码,但它仍然有同样的问题,所以我不太确定它是 VSCode。

I don't know anything about GMP, but you seem to include the wrong header.我对 GMP 一无所知,但您似乎包含了错误的标题。

#include <gmpxx.h> worked for me. #include <gmpxx.h>为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM