很多次都出现这种情况。比如有A.cpp和B.cpp,在运行A.cpp的时候显示B.cpp的结果,即使将B.cpp关掉还是会这样,而且运行窗口的标题栏明明是A.exe的路径和文件名。无法运行A.cpp了。怎么破?本来换了个VS2013,太复杂好难使用。
ringa_lee2017-04-17 13:09:12
IDE does not compile and run whatever source file you open. It depends on what project you open, so check if your a.cpp is added to the project
By the way, use VS2013 It's very simple. If you need help, I can further teach you how to use VS2013/2015
巴扎黑2017-04-17 13:09:12
It is recommended to learn early vs
After all, devcpp is an entertainment ide
天蓬老师2017-04-17 13:09:12
Easy way to use VS2013. Whenever you need to write a program, click
File->New->Project->Visual C++->Win32->Win32 Console Application
and select (Project)Name, Solution Name and Location (the default value is to create a new folder with the same name as Solution Name in Location). After filling in, you can start writing.
If you select Empty Project in the wizard, then you need to right-click on the Source directory in Solution Explorer to create a new cpp.
The rest is simple. After writing F5, if you want to take a look at the final result after outputting it, you can add a read function such as getc/cin. If you use Ctrl+F5, although you can take a look, you cannot debug it.
Because VS2013 can only open one Solution at a time, you can’t make a mistake. And if you want to open a program that you have written before, don't open the cpp file directly. You should open the solution.
ringa_lee2017-04-17 13:09:12
It seems that the author should be from a scripting language background. The executable file generated by C/Cpp is based on the entrance. It is not generated from one source file. One source file generates one o, but the final execution sequence is For classes, you still need to look at the entry function
PHPz2017-04-17 13:09:12
Could it be that before pressing Run A, you did not select the window of A and press F9 (compile).
天蓬老师2017-04-17 13:09:12
Do both cpps have main functions?
If A.cpp does not exist and B.cpp does, then B must be executed, and the main function is the entry point of the program;
If both files have main functions, in theory they should not compile if they are in the same project. That’s right, because a project can only have one entrance;
高洛峰2017-04-17 13:09:12
Dev cpp is run according to the project, not according to the file you open!
A project has only one main.