rc编译hello.rc时总是出错unexpect ends of files found,请大侠指教

leopardsmith 2003-06-02 06:32:08
我在学习深入浅出mfc第六章时用rc编译器编译hello.rc无法生成hello.res
源码如下:
///////////////////////
# filename : hello.mak
# make file for hello.exe (MFC 4.0 Application)
# usage : nmake hello.mak (Visual C++ 5.0)

Hello.exe : StdAfx.obj Hello.obj Hello.res
link.exe /nologo /subsystem:windows /incremental:no \
/machine:I386 /out:"Hello.exe" \
Hello.obj StdAfx.obj Hello.res \
msvcrt.lib kernel32.lib user32.lib gdi32.lib mfc42.lib

StdAfx.obj : StdAfx.cpp StdAfx.h
cl.exe /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" \
/D "_AFXDLL" /D "_MBCS" /Fp"Hello.pch" /Yc"stdafx.h" \
/c StdAfx.cpp

Hello.obj : Hello.cpp Hello.h StdAfx.h
cl.exe /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" \
/D "_AFXDLL" /D "_MBCS" /Fp"Hello.pch" /Yu"stdafx.h" \
/c Hello.cpp

Hello.res : Hello.rc Hello.ico jjhour.ico
rc.exe /l 0x404 /Fo"Hello.res" /D "NDEBUG" /D "_AFXDLL" Hello.rc
/////////////////////
hello.h
///////////////////
//////////////
hello.cpp
///////////////
/////////////
// hello.rc
#include "resource.h"
#include "afxres.h"



//JJHouRIcon ICON DISCARDABLE "JJHOUR.ICO"
//AFX_IDI_STD_FRAME ICON DISCARDABLE "JJHOUR.ICO"

MainMenu MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&Help"
BEGIN
MENUITEM "&About HelloMFC...", IDM_ABOUT
END
END

AboutBox DIALOG DISCARDABLE 34, 22, 147, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Hello"
BEGIN
ICON "JJHouRIcon",IDC_STATIC,11,17,18,20
LTEXT "Hello MFC 4.0",IDC_STATIC,40,10,52,8
LTEXT "Copyright 1996 Top Studio",IDC_STATIC,40,25,100,8
LTEXT "J.J.Hou",IDC_STATIC,40,40,100,8
DEFPUSHBUTTON "OK",IDOK,105,7,32,14,WS_GROUP
END
/////////////////////////////////
////////////////////
// resource.h
#define IDM_ABOUT 100
#define MainMenu 101
#define AboutBox 102
#define JJHouRIcon 128
#define AFX_IDI_STD_FRAME 129
////////////////////
///////////////////////
stdafx.h
//////////////
////////////
stdafx.cpp
/////////////////
...全文
239 16 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
leopardsmith 2003-06-09
  • 打赏
  • 举报
回复
好了,原来不是.rc文件的错误,而是resource.h没有换行,谢谢
leopardsmith 2003-06-08
  • 打赏
  • 举报
回复
我去试试
leopardsmith 2003-06-06
  • 打赏
  • 举报
回复
没有,我是从深入浅出mfc上copy下来的,分清文件了
寻开心 2003-06-06
  • 打赏
  • 举报
回复
你不是把几个文件都放在一起了把?
按照
///////////////////
分割内容保存几个不同的文件存储
leopardsmith 2003-06-06
  • 打赏
  • 举报
回复
我再加100分
slhappyls 2003-06-06
  • 打赏
  • 举报
回复
up
leopardsmith 2003-06-06
  • 打赏
  • 举报
回复
这是候捷e书上的,第353页的程序,有大侠试验过吗???
Hakki 2003-06-06
  • 打赏
  • 举报
回复
Resource Compiler Fatal Error RC1004
unexpected end of file found

This error can be caused by omitting the linefeed and carriage return characters on the last line of a text file.


将resource.h手工重新输入
Hakki 2003-06-06
  • 打赏
  • 举报
回复
NMAKE Options

/K
Continues building unrelated dependencies, if a command returns an error. Also issues a warning and returns an exit code of 1. By default, NMAKE halts if any command returns a nonzero exit code. Warnings from /K are suppressed by /C; /I overrides /K if both are specified.
Hakki 2003-06-06
  • 打赏
  • 举报
回复
NMAKE Fatal Error U1077
'program' : return code 'value'

The given command or program called by NMAKE failed and returned the given exit code.

To suppress this error and continue the NMAKE session, use the /I option, the .IGNORE dot directive, or the dash (-) command modifier. To continue the NMAKE session for unrelated parts of the dependency tree, use the /K option.
leopardsmith 2003-06-06
  • 打赏
  • 举报
回复
是考上取得,按楼上的事了,但是不行
题是信息为:
rc.exe /l 0x404 /Fo"Hello.res" /D "NDEBUG" /D "_AFXDLL" Hello.rc
resource.h(6) : fatal error RC1004: unexpected end of file found
NMAKE : fatal error U1077: 'rc.exe' : return code '0x1'
Stop.
和以前的一样
lygfqy 2003-06-06
  • 打赏
  • 举报
回复
简单方法实现:
我想你的文件是拷贝上去的吧
在你*.rc文件最后 加上回车
试试看吧,我原来也碰到过一次就这样解决了
qrlvls 2003-06-06
  • 打赏
  • 举报
回复
加上#include "stdafx.h"试试
leopardsmith 2003-06-05
  • 打赏
  • 举报
回复
you xue xi hou j de mfc dissection d ma????
leopardsmith 2003-06-03
  • 打赏
  • 举报
回复
能否举个例子,或者能告诉具体点吗
CloudWater 2003-06-02
  • 打赏
  • 举报
回复
一般是你的"stdafx.h"头文件放置不对造成的

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧