Microsoft Visual C++, compiling small source codes without project file

后端 未结 3 1692
死守一世寂寞
死守一世寂寞 2020-12-17 20:12

Well, I\'ve been using Dev-C++ for a while for learning the language [c++], and some stuff wouldn\'t work properly, like global and local variables. Then I decided to downlo

3条回答
  •  囚心锁ツ
    2020-12-17 20:18

    You can execute the compiler from the command line. First you will need to open a command prompt will all the VC++ environment variables set. Then you just invoke "cl" with the options you want.

    If you want to stay within the IDE, then you can set up an "External Tool" to compile it for you:

    1. From Visual Studio select Tools\External Tools
    2. Click "Add" on the dialog box.
    3. Pick a suitable name like "Compile"
    4. For "Command" choose cl.exe
    5. Foor "Arguments" enter $(ItemPath)
    6. Check "use Output Window" so that the compiler output is sent to the output window.

    Now, to use this, you must invoke Visual Studio with the correct environment variables set. One way is to launch a Visual Studio Command Prompt and then enter devenv.exe. Then open the file you want to compile and select the new tool under the Tools menu.

提交回复
热议问题