我建立了几种向导都不行,比如纯控制台程序,
支持mfc的console程序空工程,等等,都错误,
而代码是别人运行过的,是windows程序,
.h里面有#include "resource.h" #include "afx....
我该怎么建立个新工程,把文件添加进去才能成功运行?
谢谢
支持mfc的console程序空工程,等等,都错误,
而代码是别人运行过的,是windows程序,
.h里面有#include "resource.h" #include "afx....
我该怎么建立个新工程,把文件添加进去才能成功运行?
谢谢
resource.h给我了阿,可是还是不行。“记录工程的类“
的文件怎么用?可以修改吗?文件我是靠背到工程目录里了阿
自己的文件,还是常看到的错误:
e:\vc\vc_temp\new\game2\snake_and_russia.cpp(1) : fatal error C1083: Cannot open precompiled header file: 'Debug/game5.pch': No such file or directory
便是:e:\vc\vc_temp\new\game2\snake_and_russia.cpp(368) : fatal error C1010: unexpected end of file while looking for precompiled header directive
StdAfx.cpp
e:\vc\vc_temp\new\game2\stdafx.cpp(5) : fatal error C1083: Cannot open precompiled header file: 'Debug/game5.pch': No such file or directory
Generating Code...
Error executing cl.exe.
您可以在错误提示中看见一个文件名,
您可以找到记载文件名的地方,把它去掉或改成您自己的文件。*.pch指*.h编译过后的文件.
#include "resource.h"
#include "afx....
说明它本身是一个完整的工程,只是缺少*.dsw *.dsp
你在建立工程的时候,必须按它的名字来建立,
因为VC是按文件名来管理工程的。
菜单 Project(工程)-->Add to Project(添加到工程)-->Files(文件)
选中要加入的文件,“确定”。
如果只是加入类(*.h 和 *cpp),就已经大功告成了.
我只有1个cpp,3个.h(不是"resource.h","afxstd.h"),还是搞不点,
god
game5.cpp
e:\vc\vc_temp\new\game5\game5.cpp(1) : fatal error C1083: Cannot open precompiled header file: 'Debug/game5.pch': No such file or directory
我改成xxx.cpp为game5.cpp后,还是这样啊,指针指在#include "afxstd.h"
上,根本没game5.pch
game5.cpp
e:\vc\vc_temp\new\game5\game5.cpp(1) : fatal error C1083: Cannot open precompiled header file: 'Debug/game5.pch': No such file or directory
我改成xxx.cpp为game5.cpp后,还是这样啊,指针指在#include "afxstd.h"
上,根本没game5.pch
添加进工程,应该就可以用。
snake_game.h
russia_game.h
canvas.h
阿,
你应该还有一个和它们有关的资源文件 Resource.h-------Configuration: Game5 - Win32 Debug-----
Compiling...
Game5.cpp
E:\PROWORK\Test2\Game5\Game5.cpp(30) : error C2065: 'IDS_APP_TITLE' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(31) : error C2065: 'IDC_SNAKE_AND_RUSSIA' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(76) : error C2065: 'IDI_SNAKE_AND_RUSSIA' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(81) : error C2065: 'IDI_SMALL' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(136) : error C2065: 'IDS_HELLO' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(151) : error C2065: 'ID_Russia1' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(151) : error C2051: case expression not constant
E:\PROWORK\Test2\Game5\Game5.cpp(165) : error C2065: 'ID_Russia2' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(165) : error C2051: case expression not constant
E:\PROWORK\Test2\Game5\Game5.cpp(180) : error C2065: 'ID_Snake' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(180) : error C2051: case expression not constant
E:\PROWORK\Test2\Game5\Game5.cpp(197) : error C2065: 'IDM_ABOUT' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(197) : error C2051: case expression not constant
E:\PROWORK\Test2\Game5\Game5.cpp(198) : error C2065: 'IDD_ABOUTBOX' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(200) : error C2065: 'IDM_EXIT' : undeclared identifier
E:\PROWORK\Test2\Game5\Game5.cpp(200) : error C2051: case expression not constant
E:\PROWORK\Test2\Game5\Game5.cpp(205) : warning C4065: switch statement contains 'default' but no 'case' labels
Error executing cl.exe.Game5.exe - 16 error(s), 1 warning(s)
产生一个,我现在copy给你//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by game5.rc
//
#define IDS_HELLO 1// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
wranning,但是我也包含了resourc.h了,怎么板
选者 典型"Hello"程序.
工程名字用 game5
然后,拷贝文件到目录下,
然后,把另外三个文件加入工程。另外,
您应该还有一个resource.h文件,定义了各种资源号
也拷贝过来。
应该就可以了.我这样做了,出现
资源代号未定义错误:
Compiling...
Game5.cpp
E:\PROWORK\Test3\Game\Game5\Game5.cpp(31) : error C2065: 'IDC_SNAKE_AND_RUSSIA' : undeclared identifier
E:\PROWORK\Test3\Game\Game5\Game5.cpp(76) : error C2065: 'IDI_SNAKE_AND_RUSSIA' : undeclared identifier
E:\PROWORK\Test3\Game\Game5\Game5.cpp(151) : error C2065: 'ID_Russia1' : undeclared identifier
E:\PROWORK\Test3\Game\Game5\Game5.cpp(151) : error C2051: case expression not constant
E:\PROWORK\Test3\Game\Game5\Game5.cpp(165) : error C2065: 'ID_Russia2' : undeclared identifier
E:\PROWORK\Test3\Game\Game5\Game5.cpp(165) : error C2051: case expression not constant
E:\PROWORK\Test3\Game\Game5\Game5.cpp(180) : error C2065: 'ID_Snake' : undeclared identifier
E:\PROWORK\Test3\Game\Game5\Game5.cpp(180) : error C2051: case expression not constant
Error executing cl.exe.
resource.h了,能看看吗?我现在式式你的方法
IDC_SNAKE_AND_RUSSIA
ID_Snake
ID_Russia1
ID_Russia2
IDC_SNAKE_AND_RUSSIA (字符串 和 图标)
ID_Snake (按钮或者菜单)
ID_Russia1 (按钮或者菜单)
ID_Russia2 (按钮或者菜单)
请产生它们
(我胡乱的弄了三个按钮在 About窗口里. :) )