subject_25790.htm
来自「一些关于vc的问答」· HTM 代码 · 共 4 行
HTM
4 行
<p>
序号:25790 发表者:龙人 发表日期:2002-12-25 18:00:40
<br>主题:怎么在VC中执行*.c文件
<br>内容:建立*.c结尾的文件<BR>#include"iostream.h"<BR>#include"time.h"<BR>class TimeDate<BR>{<BR>public:<BR> TimeDate(time_t t);<BR> void Show();<BR>private:<BR> time_t systime;<BR>};<BR>TimeDate::TimeDate(time_t t)<BR>{<BR> systime=t;<BR>}<BR>void TimeDate::Show()<BR>{<BR> cout<<ctime(&systime);<BR>}<BR>void main()<BR>{<BR> time_t x;<BR> x=time(NULL);<BR> TimeDate ob(x);<BR> ob.Show();<BR>}<BR>执行后<BR>error C2061: syntax error : identifier 'TimeDate'<BR>error C2059: syntax error : ';'<BR>error C2449: found '{' at file scope (missing function header?)<BR>error C2059: syntax error : '}'<BR>error C2143: syntax error : missing '{' before ':'<BR>error C2059: syntax error : ':'<BR>error C2065: 'TimeDate' : undeclared identifier<BR>error C2146: syntax error : missing ';' before identifier 'ob'<BR>warning C4013: 'ob' undefined; assuming extern returning int<BR>error C2224: left of '.Show' must have struct/union type<BR>假如我加上#include"afxwin.h"错误为<BR>error : MFC requires C++ compilation (use a .cpp suffix)<BR>Error executing cl.exe.<BR>编译C++时,能不能不建立一个project啊<BR>2002-12-25 18:01:09
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?