c到c++的移植问题
小弟单位在VC环境下的工程有三个.c文件以及两个.h文件 我想使用字符串库在头儿文件中加入: #include <string>
using namespace std;
后编译出现如下错误:
Debug--------------------
Compiling...
Tcpip.c
d:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
Error executing cl.exe.
这是为什么呀?高手请指教!!
我新建一个C++ sourse 文件 ,编译生成工程后删除系统自己生成的文件,把原来工程里的.c文件后缀改为cpp,然后添加头文件到新工程里边,编译后又错了 晕呀,错误如下:
--------------------Configuration: TryUseStd - Win32 Debug--------------------
Compiling...
Db.cpp
d:\tryusestd\db.cpp(353) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Main.cpp
d:\tryusestd\main.cpp(718) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Tcpip.cpp
d:\tryusestd\tcpip.cpp(3996) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.
TryUseStd.dll - 3 error(s), 0 warning(s)
哎,错误是越改越多呀!这是怎么回事呀 各位大虾呀 多多指教!!!
1、.c工程如何正确移植到.cpp?只拷贝文件,改后缀是否可行?
2、c中可否使用std???
小弟非常困惑,烦了好久,各位大哥大姐一定多多帮忙呀!!谢谢了!