[英]MVCP100D.dll missing when running exe file generated by C++ code in Eclipse
I am trying to integrate AMPL with C/C++ using AMPL-API . 我正在尝试使用AMPL-API将AMPL与C / C ++集成。 I created a Makefile project in Eclipse which uses MinGW CC to compile the code. 我在Eclipse中创建了一个Makefile项目,它使用MinGW CC来编译代码。
Here is my C++ code: 这是我的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;
}
Following is my Makefile: 以下是我的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)
Contents of my project directory are: 我的项目目录的内容是:
I am having a 32-bit Windows 7 machine which have both Eclipse Mars 2.0 and Visual Studio 2015 installed on it. 我有一台32位Windows 7机器,它上面安装了Eclipse Mars 2.0和Visual Studio 2015。 Whenever I run exe file, it says MVCP100D.dll is missing. 每当我运行exe文件时,它都说MVCP100D.dll丢失了。 I looked on web and found that this error generally comes when Visual C++ Redistributable are missing. 我查看了网络,发现当错过Visual C ++ Redistributable时,通常会出现此错误。 But my system has redistributable installed on it. 但是我的系统上安装了可再发行组件。 Please help me with this. 请帮我解决一下这个。
Update: I tried to execute same code over Visual Studio 2015 and there also it is able to compile, however, I am unable to run *.exe file. 更新:我尝试在Visual Studio 2015上执行相同的代码,并且还能够编译,但是,我无法运行* .exe文件。 It also says MVCP100D.dll is missing. 它还说MVCP100D.dll丢失了。 I am not sure why this error is coming, please help!! 我不确定为什么会出现这个错误,请帮助!!
Update: Downloading the updated version works in Visual Studio 2015 but facing a separate problem specified in other post: Undefined reference to (error) in C++ Eclipse but working in Visual Studio 2015 更新:下载更新的版本适用于Visual Studio 2015,但面临其他帖子中指定的单独问题: C ++ Eclipse中未定义的(错误)引用但在Visual Studio 2015中工作
This is a bug in the beta version of the AMPL C++ API. 这是AMPL C ++ API测试版中的一个错误。 As a quick fix, the updated distribution available for download from http://ampl.com/products/api includes these DLLs. 作为快速修复,可从http://ampl.com/products/api下载的更新版本包括这些DLL。 A permanent fix will be available in the next corrective release. 永久性修复将在下一个纠正版本中提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.