I just new to c++ and using the plat form Visual studio 2010 i have two cpp files in one project and on compiling i can not execute the second file canu please tell how can i do this.
thanks
This will vary on the code, and what each cpp file does. You can store many things in a cpp file, and each will require different code to "execute". If you tell me exactly what you are trying to do in each cpp file, or copy and paste the code, I will be able to help you. We all have to start somewhere!
1 x 640Gb (SATA 300)
Western Digital: WDC WD6400AAKS-75A7B0
1 x 1Tb (SATA 600)
Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms
Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
PSU
Stock PSU - 375W
Case
Dell XPS 420
Cooling
Stock Fan
Mouse
Advent Optical ADE-WG01 (colour change light up)
Keyboard
Dell Bluetooth
Internet Speed
120 kb/s
Other Info
ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)
Ragrdless of what i am doing i just want to know that if i construct more than one programs in one project and in Visual Studio 2010 how can i get the control of compiling each program and dislaying the result what is happening with me is that i can compile the first one and run but i can not run the second one.
thanks
If you want two, completely separate .exe files or programs, you need to start a separate solution, rather than using the same solution. There is no way around this.
As I said earlier, this is very difficult for me to answer without any sort of clue as to what you want to do, as there are many things to store in a new .cpp file. I will however, give it my best shot.
What I think you would want to do is create a new method. You keep your Main method in file1.cpp. This runs your first bit of code. In your file2.cpp, you put in a Namespace, Class, and then make a new method, and call it (AdditionProcessing). You then put all of your current second .cpp file code inside this method. You then call this methd from file1.cpp.
This will run as follows:
Execution will start at the beginning of file1.cpp.
It will execute file1.cpp, until it gets to the call of the method.
Excution will jump to file2.cpp and finish everything in there.
Execution will now jump back to file1.cpp, and execute everything BELOW where the method was called, and then (proabably) exit.
1 x 640Gb (SATA 300)
Western Digital: WDC WD6400AAKS-75A7B0
1 x 1Tb (SATA 600)
Western Digital: Caviar Black, SATA 6GB/S, 64Mb cache, 8ms
Western Digital: WDC WD1002FAEX-00Z3A0 ATA Device
PSU
Stock PSU - 375W
Case
Dell XPS 420
Cooling
Stock Fan
Mouse
Advent Optical ADE-WG01 (colour change light up)
Keyboard
Dell Bluetooth
Internet Speed
120 kb/s
Other Info
ASUS USB 3.0 5Gbps/SATA 6Gbps - PCI-Express Combo Controller Card (U3S6)