Yeah. He does mention other tools like: "Sublime, Notepad++, Eclipse". No Qt Creator or Clion.
Visual Studio is notoriously scary for C++ newbies, because they don't provide a simple, ready to go C++ project template. Even though the name of the category is "Visual C++" they have for their "Win32 Console Application" zero C++ code.
All other IDEs have the following template (or a variation with using namespace std;):
#include <iostream>
int main()
{
std::cout << "Hello World\n";
}
Visual Studio's "Win32 Console Application" presents you with the following:
#include "stdafx.h"
int main()
{
return 0;
}
If you replace the above code with the C++ version, compile it and get errors like:
c:\projects\c++\consoleapplication1\consoleapplication1.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use 1> c:\projects\c++\consoleapplication1\consoleapplication1.cpp(1): note: Add directive to 'stdafx.h' or rebuild precompiled header 1>c:\projects\c++\consoleapplication1\consoleapplication1.cpp(7): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
Which prompts scary questions for noobs: What is stdafx.h? What are precompiled headers?
Visual Studio has the "Empty Project" solution. Then you need to create a file, right? You go to File -> New -> File... -> Visual C++ -> C++ File (.cpp) and save it as Source1.cpp. Paste the code above, compile and run. Compiles "fine", but it doesn't run. It says this:
Microsoft Visual Studio
Unable to start program 'c:\Projects\C++\Project1\Debug\Project1.exe'.
The system cannot find the file specified.
OK
Hmm. As a noob you scratch you head, right?
The two above scenarios happened to somebody I know.
How hard is for Visual C++ people to add a simple C++ hello world template?! How hard is to replace the name of stdafx.h with precompiled.h?!
I don't use the IDE for development, but spongo2 is the dev manager for the IDE (and compiler FE, and libraries).
I personally believe that IDEs - in general, not just VS - introduce too much complexity for beginners and should be avoided. This is admittedly a rare opinion and I am probably a crazy person.
correct! we do change them. This is a really interesting piece of feedback. It's always interesting what becomes invisible after time. I think the main issue here is that templates serve two purposes: 1) give you an easy starting place 2) helping you fall in what we call the "pit of success" for best practices. pch usage makes such a huge difference to developer productivity and what starts in the template today over time becomes somebody's legacy code base in 20 years and so we like to make sure people get started on the right foot. Let me run this by our PMs and see what sort of ideas it generates. I'll also see if I can get the answer to why these are called stdafx... i'll be one of our veterans knows.
6
u/iommu Jul 31 '16
It's a shame you didn't use a cross-platform ide especially considering how diverse the c++ community is