Home > Back-end >  VS2019 write two programs in the same project, but forever can debug the first program
VS2019 write two programs in the same project, but forever can debug the first program

Time:04-23

Novice small white, questions are stupid and hope you forgive me, you are cordially invited to give directions! Thank you

I use is visual studio 2019.

In a project I wrote two programs, but each time you perform debug only execute programs written in the first,
I also found that as long as I put the first out of the project program, a second program can perform, display an error below


And two programs I use function names are not the same,

Excuse me expert predecessors how to solve a problem! Thank you very much

CodePudding user response:

Can you upload all the code

CodePudding user response:

Right-click the project name, set to start the project

CodePudding user response:

1 set to start projects or right start project instance
2. One project seems to be the main function, is to compile the library?

CodePudding user response:

reference 1st floor weixin_40667060 response:
can you upload all the code


project name: 01 helloworld

the first person to program code below :
 
# include
using namespace std;

Int main () {

//on the screen display content
Cout & lt; <"Hello world!"

system("pause");

return 0;
}


a second program code below
 
# include
using namespace std;

Int main () {

//on the screen display content
Cout & lt; <"Hello world!"

system("pause");

return 0;
}

CodePudding user response:

There can be only one main () function, the second project main should main1 instead

CodePudding user response:

A project corresponding to a complete program, you should create two principles of two programs, if you don't want to, then when debugging a program can be another program all commented,

CodePudding user response:

In the past so long the building should be solved... But the reason for the error is only one main function inside a project if to write two programs need to create a new project

CodePudding user response:

You can right-click the first uninstall program, debugging is the second

CodePudding user response:

Only one main function in a project

CodePudding user response:

Mail to switch the startup project
  • Related