This species does not just magically happen on its own; you have changed something! In industry, we use version control to create regular savepoints, so when something goes wrong, we can track the changes we made, which led to this problem.
Since you did not do this, we can only guess. In Visual Studio, Intellisense (a technology that gives you automatic popup of drop-down lists and these reddish lines) works separately from the real C ++ compiler under the hood and is sometimes a little bit wrong.
In this case, I would ask why you include both cstdlib and stdlib.h ; You should use only one of them, and I recommend it. They basically represent the same header, the C header, but cstdlib puts them in the std namespace to have their "C ++ - ise". Theoretically, including one and the other will not conflict, but, well, this is Microsoft, which we are talking about. Their C ++ toolchain sometimes leaves much to be desired. Whenever Intellisense disagrees with the compiler, this should be considered a mistake, no matter how you look at it!
In any case, using namespace std (which I would recommend against in the future) means that std::system from cstdlib now conflicts with system from stdlib.h . I cannot explain what happens to std::cout and std::cin .
Try removing #include <stdlib.h> and see what happens.
If your program works successfully, you don’t need to worry too much about it, but I can imagine that false positives annoy you when you work in your development environment.
source share