在Eclipse中运行C++代码生成的exe文件时缺少MVCP100D.dll
MVCP100D.dll missing when running exe file generated by C++ code in Eclipse
我正在尝试使用AMPL-API将AMPL与C/C++集成。我在Eclipse中创建了一个Makefile项目,该项目使用MinGWCC来编译代码。
这是我的C++代码:
#include <iostream>
#include "ampl/ampl.h"
using namespace std;
int main() {
ampl::AMPL ampl;
// Read the model and data files.
std::string modelDirectory = "models";
ampl.read(modelDirectory + "/diet/diet.mod");
ampl.readData(modelDirectory + "/diet/diet.dat");
// Solve
ampl.solve();
// Get objective entity by AMPL name
ampl::Objective totalcost = ampl.getObjective("total_cost");
// Print it
std::cout << "Objective is: " << totalcost.value() << std::endl;
}
以下是我的Makefile:
CC = g++
CFLAGS = -O2 -g -Wall -fmessage-length=0
INCLUDES = -I "C:\Local\AMPL\amplide.mswin32\amplide.mswin32\amplapi\include"
OBJS = AMPL.o
LIBS = -lampl1.2.2
TARGET = AMPL.exe
$(TARGET): $(OBJS)
$(CC) -L "./" -o $(TARGET) $(OBJS) $(LIBS)
AMPL.o: AMPL.cpp
$(CC) $(CFLAGS) $(INCLUDES) -c AMPL.cpp
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
我的项目目录的内容是:
- .settings/
- 模型/
- 饮食/
- diet.dat
- diet.mod
- 饮食/
- .cp项目
- .项目
- AMPL.cpp
- AMPL.exe
- AMPL.o
- ampl2.2.2.lib
- Makefile
我有一台32位的Windows 7机器,上面安装了Eclipse Mars 2.0和Visual Studio 2015。每当我运行exe文件时,它都会说缺少MVCP100D.dll。我在网上查了一下,发现这个错误通常发生在缺少Visual C++Redistributable的时候。但是我的系统已经安装了可重新分发的软件。请帮我解决这个问题。
更新:我试图在Visual Studio 2015上执行相同的代码,它也可以编译,但我无法运行*.exe文件。它还说MVCP100D.dll不见了。我不知道为什么会出现这个错误,请帮忙!!
更新:下载更新版本可以在Visual Studio 2015中使用,但面临另一篇文章中指定的单独问题:在C++Eclipse中未定义的引用(错误),但可以在Visual Studio2015 中使用
这是AMPL C++API测试版中的一个bug。作为快速修复,更新后的分发版可从下载http://ampl.com/products/api包括这些DLL。永久性修复将在下一个更正版本中提供。
相关文章:
- 挂起和取消挂起一个文件DLL
- 如何指定我希望我的LIB链接到的DLL文件?-Visual Studio 2019
- 在 Windows 上,是否可以让 dll 在不使用 PATH 环境变量的情况下在另一个文件夹中查找依赖项?
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- 将 dll 文件注入 UWP
- 加载"D:UsersPublicDocumentsopencvbuildx64vc14binopencv_world340d.dll",找不到或打开PDB文件
- CMake 生成的 MSVC 项目找不到符号,即使为其相关 dll 正确生成了 lib 文件也是如此
- 错误:当我从"WinDbg"打开可执行文件时,找不到符号文件。默认导出 ntdll 的符号.dll
- 在使用 Clang 编译 DLL 时指定 DEF 文件
- 从 .lib 文件创建一个.dll文件
- 可执行文件C++包括.obj,.lib和.dll吗?
- python37.dll在可执行文件中未链接
- 链接器找不到导入的 DLL 的 LIB 文件
- DLL:当 SDK 头文件不使用 __declspec(dllexport) 时,我可以使用它吗
- sf::Windows上的音乐:api-ms-win-crt-locale-l1-1-0.dll:无法打开共享对象文件
- 如何在 CMake 超级生成中查找 dll/so 文件
- 在任何平台上执行任何Qt5应用程序的重要dll文件是什么(运行时文件dll)
- 在C++的应用程序中包括文件(dll,txt等.exe
- 反编译文件.dll
- 另一台电脑上的C++程序所需的文件/DLL