How to use the Visual Studio 2012 command line tool from system()

Posted by Janice Regan on Stack Overflow See other posts from Stack Overflow or by Janice Regan
Published on 2013-11-04T16:45:06Z Indexed on 2013/11/04 21:54 UTC
Read the original article Hit count: 197

Filed under:
|
|

I am attempting to compile and run one visual C++ program (project1) from another visual C++ program (project2) using msbuild and other commands available in the Visual studio command line tool but not in the windows command line tool. Everything works fine if I run it in the visual studio command line tool. For example I can build using msbuild and it works just as I want it to. When I try to run the same command in my C++ program using system(), the system call appears to use the Windows command line and therefore cannot find any of the commands (msbuild in this example). I am new to working with system() on windows (although I have extensive experience with it using Linux). Is there some way to make my C++ program use the Visual Studio command line environment when I call system (rather than Windows command line environment)? Using the command window manually is not an option. I need to compile and test a series of 200-300 different versions of the program in the project1. This is why I am writing program2

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2012