如何在 eclipse 中构建代码之前运行 vcvars32.bat

How can I run vcvars32.bat before code build in eclipse?

本文关键字:运行 vcvars32 bat 代码 构建 eclipse      更新时间:2023-10-16

我想用cl编译器编译我的c ++代码。因此,我在 eclipse 中启动了一个"c ++ makefile 项目"。然后我写了我的制作文件。我必须运行 vcvars32.bat首先运行 cl,所以我在 make 文件中编写了该命令,因为它无法正常工作。我现在应该怎么做?如何在构建代码之前运行该命令?顺便说一下,我正在使用 nmake。

我的制作文件如下:

OBJS =      helloWorld.o
TARGET =    helloWorld.exe
all:    $(TARGET)
helloWorld.exe: 
    **vcvars32.bat**
    cl helloWorld.cpp
    rm -f *.obj
clean:
    rm -f helloWorld.exe *.obj

打开命令行,运行 vcvars32.bat,然后从同一命令行启动 eclipse。

前两个步骤可以通过转到Start->Visual Studio xxx->Visual Studio Tools->VS command prompt合并为一个(确切的命名取决于您安装的内容)