Turbo C + + is a classic software, but it has already exited the history stage of programming. Nonetheless, some of its header files (such as conio.h/graphics.h) are not as practical as they are. recently I was doing a console snake game Small project, this small project will use the Conio.h header file, but in the addition of multi-file project encountered some trouble. After several setbacks, finally found a solution. For specific steps, look down:
1. First create a *. PRJ file, here's an example of TEST.PRJ. Enter the following text in TEST.PRJ and save:
Main.cppsource.cpp
2. Start-and-run input cmd-> Enter, you can see the following interface: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M02/79/11/ Wkiom1ahxq-iecrjaabffilb1pk009.png "title=" Cmd.png "alt=" Wkiom1ahxq-iecrjaabffilb1pk009.png "/>
3.CD to the bin directory in your TC3.0 installation directory, my TC is installed in the F-drive:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/79/0F/wKioL1aHXbmBgfP9AABaCwSyUGE575.png "title=" Cmd2.png "alt=" Wkiol1ahxbmbgfp9aabacwsyuge575.png "/>
4. If you observe, you will find a PRJCNVT.EXE file in the bin directory. Yes! We are going to use this file to convert our TEST.PRJ file into a project file that can be TC3.0 recognized! Then, in cmd, enter PRJCNVT.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/0F/wKioL1aHXneCX2WcAACE19mH02c735.png "title=" Qq20160102132200.png "alt=" Wkiol1ahxnecx2wcaace19mh02c735.png "/>
5. According to the instructions, enter the command: PRJCNVT [filename to convert. prj] [file name after conversion. PRJ]
Then we enter PRJCNVT F:\test.prj F:\test2.prj.
6. The conversion is successful, you will find one more test2.prj file
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/0F/wKioL1aHX-fA4vRJAAAss-jKv1g202.png "title=" Zhuanhuachengg.png "alt=" Wkiol1ahx-fa4vrjaaass-jkv1g202.png "/>
7. Then, drag the converted Prj file below the TC.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/10/wKioL1aHZp2SRBywAAFT1f-1hT0772.png "title=" Qq20160102132937.png "alt=" Wkiol1ahzp2srbywaaft1f-1ht0772.png "/>8. OK, double-click the file under FileName to start editing.
Main.cpp:
#include <stdio.h>extern int max (int a, int b); int main () {printf ("%d\n", Max (10, 12)); GetChar (); return 0;}
Source.cpp:
int max (int a, int b) {return a > B? a:b;}
9. Compile-to-link, view the output results, sure enough.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/11/wKiom1aHaFjA4x-nAAAjUP3GQxg417.png "title=" Qq20160102140349.png "alt=" Wkiom1ahafja4x-naaajup3gqxg417.png "/>
Precautions:
1. If you want to add a header file, it is the same, only with the first step to add *.h, and then in the corresponding CPP file added: #include "*.h" on it. But do not compile and link operations in the header file (as if it were going to be an error), compile and link the file where the main function resides.
2. If the file where your main function resides is *.cpp, and the prototype of the function called inside is *.C, do not use the extern statement, please add # include "*.c" at the beginning. (i.e., if other files are CPP, extern, other files are C # # #)
This article from "mlh1719233148 Blog" blog, reproduced please contact the author!
Turbo C + + 3.0 ways to create multi-file projects