Error “system” is ambiguous?

You need to #include <cstdlib>

Source: http://en.cppreference.com/w/cpp/utility/program/system

Also, try to avoid system, it’s dangerous. To pause the program when it’s finished, put a breakpoint on the } at the end of main. There isn’t a standard way to clear the screen unfortunately.

For future reference, the red squiggles are intellisense errors, which are shown by a different front-end than the one that actually compiles the code, so the red squiggles are sometimes wrong, especially with complex templates. In most cases, including this one, it’s correct though.

Leave a Comment