/Tc 选项指定 filename 为 C 源文件,即使它没有 .c 扩展名。/Tp 选项指定 filename 为 C++ 源文件,即使它没有 .cpp 或 .cxx 扩展名。选项和 filename 之间的空格可选。每个选项指定一个文件;若要指定其他文件,请重复此选项。/TC 和 /TP 是 /Tc 和 /Tp 的“全局”变形。它们指定编译器将在命令行上指定的所有文件视为 C 源文件 (/TC) 或 C++ 源文件 (/TP),而不考虑它们在命令行上相对于选项的位置。这些全局选项可以在单个文件上通过 /Tc 或 /Tp 重写。默认情况下,CL 假定扩展名为 .c 的文件是 C 源文件,扩展名为 .cpp 或 .cxx 的文件是 C++ 源文件。示例
下列 CL 命令行指定 MAIN.c、TEST.prg 和 COLLATE.prg 都是 C 源文件。CL 将不识别 PRINT.prg。
CL MAIN.C /TcTEST.PRG /TcCOLLATE.PRG PRINT.PRG
下列 CL 命令行指定 TEST1.c、TEST2.cxx、TEST3.huh 和 TEST4.o 作为 C++ 文件编译,TEST5.z 作为 C 文件编译。
CL TEST1.C TEST2.CXX TEST3.HUH TEST4.O /Tc TEST5.Z /TP
下列 CL 命令行指定 MAIN.c、TEST.prg 和 COLLATE.prg 都是 C 源文件。CL 将不识别 PRINT.prg。
CL MAIN.C /TcTEST.PRG /TcCOLLATE.PRG PRINT.PRG
下列 CL 命令行指定 TEST1.c、TEST2.cxx、TEST3.huh 和 TEST4.o 作为 C++ 文件编译,TEST5.z 作为 C 文件编译。
CL TEST1.C TEST2.CXX TEST3.HUH TEST4.O /Tc TEST5.Z /TP
解决方案 »
- 帮忙看看这个链接错误应该怎么解决
- 结构体指针的问题
- 关于指针的问题
- 一个困扰我一周的问题(如何把两个功能融合到一个对话框上而不冲突)
- 哪里可以下载到比较新的Microsoft Platform SDK?
- 求查找内存泄漏的方法,或工具
- 有谁做过像资源管理器的程序,我做了一个在98下出问题,SHGetFileInfo搞得系统没了图标?
- 怎样添加控件呢?
- C++实现桌面共享?
- VC insert into数据到SQL数据库,timestamp,uniqueidentifier(UUID)和decimal(23, 10)数据怎么初始化?
- vc编写串口小应用程序时,编译与连接都没有问题,但点击生成EXE文件却没有反映,是什么回事?
- 很急 请高手帮帮忙了!! 在线等
这只是根据实验结果得到的结论,哪位大师有不同意见,还望指正。
Compiler Options | Setting Compiler Options
/Tcfilename
/Tpfilename
/TC
/TP
where: filename
A C or C++ source file.
Res
The /Tc option specifies that filename is a C source file, even if it doesn't have a .c extension. The /Tp option specifies that filename is a C++ source file, even if it doesn't have a .cpp or .cxx extension. A space between the option and filename is optional. Each option specifies one file; to specify additional files, repeat the option./TC and /TP are "global" variants of /Tc and /Tp. They specify to the compiler to treat all files named on the command line as C source files (/TC) or C++ source files (/TP), without regard to location on the command line in relation to the option. These global options can be overridden on a single file via /Tc or /Tp. By default, CL assumes that files with the .c extension are C source files and files with the .cpp or the .cxx extension are C++ source files. To set this compiler option in the Visual Studio development environment Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the C/C++ folder.
Click the Advanced property page.
Modify the Compile As property.
To set this compiler option programmaticallySee CompileAs Property.Examples
The following CL command line specifies that MAIN.c, TEST.prg, and COLLATE.prg are all C source files. CL will not recognize PRINT.prg.CL MAIN.C /TcTEST.PRG /TcCOLLATE.PRG PRINT.PRG
The following CL command line specifies that TEST1.c, TEST2.cxx, TEST3.huh, and TEST4.o are compiled as C++ files, and TEST5.z is compiled as a C file. CL TEST1.C TEST2.CXX TEST3.HUH TEST4.O /Tc TEST5.Z /TP