如何在 Windows 上为 Dev

编程入门 行业动态 更新时间:2024-10-25 23:23:51
本文介绍了如何在 Windows 上为 Dev-C++ 安装 C++ 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我下载了一个名为 GMP 的库(用于对任意大数进行计算),但我不知道如何实际安装和使用它.我找到的所有指令都告诉我运行文件 configureMakeFileinstall,但是当我尝试这样做时,我得到 'install' 不是可识别的内部或外部命令.

I downloaded a library called GMP (it's for doing calculations with arbitrarily large numbers) and I can't figure out how to actually install and use it. All of the instructions I find tell me to run the files configure, MakeFile, and install, but when I try to do that I get 'install' is not a recognized internal or external command.

我所能想到的就是这些说明适用于 Linux,但我运行的是 Windows.我在这里找到了一些关于 SO 的说明,告诉我将某些文件复制到 Dev-C++ 文件夹中,但我找不到指定的文件.我以前从来没有安装过这样的库,所以我真的迷路了.f

All I can figure is that the instructions are for Linux, but I'm running Windows. I found a couple of instructions here on SO that tell me to copy certain files into the Dev-C++ folder, but I can't find the files specified. I've never had to install a library like this before, so I'm really lost.f

推荐答案

如果你有最新版本的 Dev-C++,附带 MinGW-w64(作为它的原生环境),那么你可以下载 GMP 的预构建包来自 此处.之后你所要做的就是:

If you have latest version of Dev-C++, that ships with MinGW-w64 (as its native environment), then you may download pre-builded package of GMP from here. After that all you have to do is:

创建简单的 C++ 控制台项目.

这是一些基本的main.cpp文件:

#include <cstdio>
#include <gmp.h>

int main(int argc, char** argv) {
    mpz_t n;

    mpz_init_set_str(n, "1234567890", 0);

    gmp_printf("%Zd\n", n);

    mpz_clear(n);

    return 0;
}

解压存档将 gmp.h 头复制到 Dev-Cpp\MinGW64\x86_64-w64-mingw32\includelibgmp.dll.a复制到MinGW64\x86_64-w64-mingw32\liblibgmp-10.dll 共享库复制到Dev-Cpp\MinGW64\bin编辑项目的属性,将 -lgmp 标志添加到链接器(查找参数选项卡)编译&运行 Unpack archive Copy gmp.h header into Dev-Cpp\MinGW64\x86_64-w64-mingw32\include Copy libgmp.dll.a into MinGW64\x86_64-w64-mingw32\lib Copy libgmp-10.dll shared library into Dev-Cpp\MinGW64\bin Edit properties of your project, add -lgmp flag into Linker (look for Parameters tab) Compile & Run

如果你想要其他版本或者C++接口,那么你需要找到现有的build或者尝试在MinGW环境下编译.

If you want other version or C++ interface, then you need to find existing build or try to compile it under MinGW environment.

这篇关于如何在 Windows 上为 Dev-C++ 安装 C++ 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 22:56:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1125522.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上为   如何在   Windows   Dev

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!