Search code examples
c++visual-studio-2019execution

Visual Studio 2019 is not running other .cpp files


enter image description here

New to VS and C++. I'm trying to run code for source file "test2.cpp." However, every time I run the program, VS always runs "Simple-letter-with-ASCII-number.cpp."

I'm on the "test2.cpp" window, but the file never runs. I need assistance in running "test2.cpp" and not "Simple-letter-with-ASCII-number.cpp," without deleting any .cpp files, if possible.

  • Both .cpp files have different labeled main()
  • Both .cpp files are in the same project

Solution

  • Your project will call main() when it runs. When you said “differently labeled main()” I am assuming you changed a main() to test2main(). Just change the main function you want to run to be main() and your program should run when you recompile.