Open Visual C++ with arguments to compile

Asked

Viewed 114 times

0

I am starting with the visual C++ and I have a project where it is necessary the visual c++ to compile the program automatically. so I thought of arguments like we can use in normal prompt like:

cmd /k cd c:/Windows

But I did not find how to do this since the visual c++ is a shortcut that already uses this preargument /k. %comspec% /k ""C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"" amd64_arm

I also thought of making a script. bat to open the visual c++ and compile.

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"" amd64_arm;
cd C:\Users\Huron\Desktop\Injector\RandoInjector;
cl main.cpp;

And it works only to open the visual c++.

So I’m at this impasse Someone has some idea how to do this?

1 answer

-1

You can use cl.exe which is the command-line compiler of Visual Studio. Even you don’t even need Visual Studio, could use only build tools that would already do this.

The first step is to open the console using one of the shortcuts that are in Visual Studio in the start menu, there you will find 32 and 64 bit options.

One tool you might consider using since you’re looking to build outside of VS is using Cmake.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.