手动编译cpp文件(window下)

本文介绍如何在Windows环境下使用VC6.0中的CL编译器进行C++程序的编译工作。主要内容包括编译器的位置、编译命令的使用、解决链接错误的方法以及环境变量的配置。

在windows的编译工具是cl


安装完vc6.0后目录为  C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin 下。 【cl程序是绿色的,但不清楚其他依赖项】


开始的时候用editPlus 编辑cpp文件,然后用该工具去cmd中编译,编译命令为    F:\test> cl -GX myTest.cpp

[由于环境配置,这样直接执行编译命令很可能会出现链接错误]


解决办法

1.配置上环境变量

2.进入cmd命令 ,执行C:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT (直接拖进去回车)


这样找不到lib的链接错误就没有了。


生成开始于 15:47... 1>------ 已启动生成: 项目: window_data_stream_test, 配置: Debug x64 ------ 1>window_data_stream_test.cpp 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(802,77): error C2001: 常量中有换行符 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(831,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(806,35): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(917,35): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream.hpp(955,35): warning C4267: “参数”: 从“size_t”转换到“int”,可能丢失数据 1>(编译文件window_data_stream_test.cpp) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(61,65): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(103,69): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(64,9): error C2146: 语法错误: 缺少“;”(在标识符“size_t”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(90,28): warning C4018: “<”: 有符号/无符号不匹配 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(105,9): error C2143: 语法错误: 缺少“;”(在“return”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(233,18): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(234,10): error C2143: 语法错误: 缺少“;”(在“std::cout”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(255,18): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(256,10): error C2143: 语法错误: 缺少“;”(在“std::cout”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(261,34): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(262,5): error C2143: 语法错误: 缺少“)(在“}”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(262,5): error C2143: 语法错误: 缺少“;”(在“}”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(279,22): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(280,9): error C2143: 语法错误: 缺少“;”(在“return”的前面) 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(323,111): error C2001: 常量中有换行符 1>D:\program\cpp\window_data_stream_test\window_data_stream_test\window_data_stream_test.cpp(324,5): error C2146: 语法错误: 缺少“;”(在标识符“stats_ss”的前面) 1>已完成生成项目“window_data_stream_test.vcxproj”的操作 - 失败。 ========== 生成: 0 成功,1 失败,0 最新,0 已跳过 ========== ========== 生成 于 15:47 完成,耗时 01.854 秒 ==========
最新发布
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值