0

I am a beginner in C++ and I am interested in using the MSVP compiler for compiling my code as well as Visual Studio Code. I am facing a problem with the configuration of the MSVP compiler with VS Code.

I have read the article about the configuration given at this link-https://code.visualstudio.com/docs/cpp/config-msvc. I have configured the compiler and everything works fine. According to the article, each and every project I make requires this configuration, which needs to be copied and pasted in the .vscode folder of every project I make. But, I am not interested in doing this. I want that each project or I make should automatically take up this configuration.

I tried figuring out this problem on my own by putting two or three code files in the folder named helloworld because then all these files would take the same configuration and would get debugged separately, but the main problem is created by this part of the tasks.json file:

 "args": [
                "/EHsc",
                "/Zi",
                "/Fe:",
                "helloworld.exe",
                "helloworld.cpp"
            ]

This part tells the compiler that the code file HAS to be helloworld.cpp and the executable has to be named helloworld.exe.

In the end, I would like to tell that I want VS Code to be configured like the Visual Studio IDE, where you just type the code by creating a project and the executable gets named just like the code file. For example, the executable of hello.cpp is named hello.exe, and one doesn't need to copy and paste any configuration file anywhere. Also, I would like to tell that I HAVE to use VS Code only. Any help would be appreciated.

Thank you !

A_Singh7
  • 648
  • 7
  • 15
  • Please anyone help me out with this. – A_Singh7 May 14 '19 at 11:42
  • If you don't get an answer, it means the question isn't good, but it's not so bad that it will get downvoted. – Panagiotis Kanavos May 14 '19 at 12:01
  • As for your other question about auto, read the [C++ guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md). You'll see that `auto` is used almost everywhere – Panagiotis Kanavos May 14 '19 at 12:05
  • Can you help me out with this question ? – A_Singh7 May 14 '19 at 12:06
  • 1
    Possible duplicate of [How do I set up Visual Studio Code to compile C++ code?](https://stackoverflow.com/questions/30269449/how-do-i-set-up-visual-studio-code-to-compile-c-code) – Panagiotis Kanavos May 14 '19 at 12:07
  • As for *this* question, it's been asked before. The duplicate explains that build settings are per project. VS Code is a cross platform IDE and doesn't use a specific compiler by default, in fact it doesn't even know about a language until you add an extension for it. All these are controlled by each project's build settings. The C++ section in the docs points to 4 different compilers. Outside Windows, gcc and clang are the most popular choice. If you check C++ github repos you may find *multiple* build scripts for the same project – Panagiotis Kanavos May 14 '19 at 12:13

0 Answers0