gpt4 book ai didi

c++ - 在 Eclipse 中运行由 C++ 代码生成的 exe 文件时缺少 MVCP100D.dll

转载 作者:太空宇宙 更新时间:2023-11-04 13:15:33 25 4
gpt4 key购买 nike

我正在尝试整合 AMPL使用 C/C++ 使用 AMPL-API .我在 Eclipse 中创建了一个 Makefile 项目,它使用 MinGW CC 来编译代码。

Here is my C++ code:

#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:

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:

  • .设置/
  • 模型/
    • 饮食/
      • 饮食数据
      • diet.mod
  • .c项目
  • .项目
  • AMPL.cpp
  • AMPL.exe
  • AMPL.o
  • ampl1.2.2.lib
  • 生成文件

我有一台 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,但面临其他帖子中指定的单独问题:Undefined reference to (error) in C++ Eclipse but working in Visual Studio 2015

最佳答案

这是 AMPL 测试版中的错误C++ API。作为快速修复,可从 http://ampl.com/products/api 下载更新的分发版包括这些 DLL。下一个更正版本中将提供永久修复。

关于c++ - 在 Eclipse 中运行由 C++ 代码生成的 exe 文件时缺少 MVCP100D.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37552398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com