同样的工程在我机器上就报错,搞不懂

3m2u 2004-12-05 02:40:35
一个工程本来在我机器上好好的,结果后来不知怎么的就编译不过去了。提示
d:\program files\microsoft visual studio\vc98\include\mshtml.h(26) : error C2146: syntax error : missing ';' before identifier 'IHTMLStyle'
d:\program files\microsoft visual studio\vc98\include\mshtml.h(26) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

但是把这个工程放到另一台机器上却好用。为此我都把自己的vc卸载重装了都不好用。还是提示这个问题。郁闷了 :(
...全文
230 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
3m2u 2004-12-07
  • 打赏
  • 举报
回复
lzzqqq(Jonersen)
应该不是头文件的问题,因为我在另一台机器上的工程和我的是完全相同的,能编译。
而且我的也没有用mfc之类的,没有stdafx.h

pknife(小李飞刀)
我原来在本机是可以编译通过的。不知道怎么搞的就不行了 :(
不是安装路径的问题。

chqu18(Debug)
我自己编译通不过的东东,传到另一台机器则编译通过,然后把这些文件考回来依然通不过。

lejins(不如)
我觉得你说的有道理,但是我也考虑到了:我原来机器上装了sdk的。而且编译出问题的时候也是有sdk的,但是有问题。后来我重装了vc 重装了sdk试图解决这个问题,重装的时候甚至把microsoft visualstudio . microsoft sdk两个目录,还有上面提到的注册表都删除了,可是仍然有问题,搞得我很郁闷。而且我装的sdk都是我本机上存的,以前和现在应该是一样的,以前能编译现在应该也能吧。

今天我又试了一下,在一台没有vc的98上装了vc编译我的工程,出同样的错误,打sp6也是。但装sdk会报错。这样看来可能还是sdk的问题,我再重新装一下试试。


再加点分,希望大家能帮我分析分析。
3m2u 2004-12-07
  • 打赏
  • 举报
回复
谢谢。问题解决了。如 sungengyu(快乐机器) 所言。我把include/lib设置中的sdk目录放到最前面,就可以了。原来是这个原因,费了我好长时间来研究 :(

不过还好最终找出了问题所在。谢谢以上各位了啊 :)
sungengyu 2004-12-07
  • 打赏
  • 举报
回复
Tools -> Options -> Directories 中的顺序换一换。
zxwitsme 2004-12-07
  • 打赏
  • 举报
回复
检查2个机器的windows版本看是不是一样
lzzqqq 2004-12-06
  • 打赏
  • 举报
回复
肯定是乱引用头文件引起的。我原来经常遇到这种问题。
把你引用的头文件放到 stdafx.h 里。
而不要其他 .h 或.cpp文件里。
lejins 2004-12-06
  • 打赏
  • 举报
回复
你的mshtml.h跟Internet Development SDK 的版本检查一下看看是不是相同的。
最好把这mshtml.h删掉再重装Internet Development SDK。
小李匪盗 2004-12-06
  • 打赏
  • 举报
回复
一个装在了C盘,一个装在了D盘,就这么简单
chqu18 2004-12-06
  • 打赏
  • 举报
回复
可能是编译环境引起,看看两台机器的编译环境有什么不同
likunfeng 2004-12-06
  • 打赏
  • 举报
回复
看看两台机子上的 vc 是安装在相同路径下吗?
看到你其中一台 路径为 d:\program files\microsoft visual studio\vc98\
另一台是不是?
这个问题可能和安装路径有关系!
3m2u 2004-12-05
  • 打赏
  • 举报
回复
我真要崩溃了 :(

除了program files\microsoft visual studio
hk_local_machine\software\microsoft\devstudio\6.0
hk_local_machine\software\microsoft\visualstudio\6.0

还有哪里有和vc6相关的文件或者设置啊
我要把他们全删除掉。。。
lzlbj 2004-12-05
  • 打赏
  • 举报
回复
chongzhuangcaozuoxitong
3m2u 2004-12-05
  • 打赏
  • 举报
回复
难道是头文件包含顺序有问题?可是这个代码在别的机器上就好使,能用的。
头文件声明如下

#include <afxwin.h>
#include <windows.h>

#include <mshtml.h>
#include <exdispid.h>

#include <atlbase.h>



CComModule _Module;
#include <atlwin.h>
#include <atlcom.h>
#include <atlhost.h>
如果这样写就会提示:
d:\program files\microsoft visual studio\vc98\include\mshtml.h(26) : error C2146: syntax error : missing ';' before identifier 'IHTMLStyle'
d:\program files\microsoft visual studio\vc98\include\mshtml.h(26) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

如果我把atlbase.h放到mshtml.h前面的话
#include <afxwin.h>
#include <windows.h>

#include <atlbase.h>

#include <mshtml.h>
#include <exdispid.h>

CComModule _Module;
#include <atlwin.h>
#include <atlcom.h>
#include <atlhost.h>

编译时会提示:
error C2065: 'IHTMLElement2' : undeclared identifier
error C2065: 'pElement2' : undeclared identifier
error C2106: '=' : left operand must be l-value
error C2065: 'IID_IHTMLElement2' : undeclared identifier
error C2227: left of '->get_scrollHeight' must point to class/struct/union
error C2227: left of '->get_scrollWidth' must point to class/struct/union
Error executing cl.exe.
hongzm 2004-12-05
  • 打赏
  • 举报
回复
不会,同情,学习!
3m2u 2004-12-05
  • 打赏
  • 举报
回复
抓狂了,重装sdk也不好使 nnd.怎么办啊
3m2u 2004-12-05
  • 打赏
  • 举报
回复
装了啊 就差Windows Media SDK 没装了
不过重装vc以后我没重装过sdk,安装sdk时能检测到原来安装的
难道得再重新装一次?那还得先把安装的删除了啊。试试先

All Products | Support | Search | microsoft.com Guide Home | Downloads | Order CD | Feedback | Help |


--------------------------------------------------------------------------------
Downloads
MS Product Catalog
Microsoft Accessibility

--------------------------------------------------------------------------------
Server Products
Developer Tools
Office Family
Windows Family
MSN

--------------------------------------------------------------------------------
Knowledge Base
Product Support Options
Service Partner Referrals

--------------------------------------------------------------------------------
Search microsoft.com
MSN Web Search

--------------------------------------------------------------------------------
microsoft.com Home
MSN Home

--------------------------------------------------------------------------------
Contact Us
Events
Newsletters
Profile Center
Training & Certification
Free E-mail Account

--------------------------------------------------------------------------------
Install
Redistributables (Internet)

--------------------------------------------------------------------------------
US/Canada (Internet)
International (Internet)

--------------------------------------------------------------------------------
Send Feedback (Internet)

--------------------------------------------------------------------------------
Instructions
Release Notes
FAQ
Support Options (Internet)
Installed SDKs

--------------------------------------------------------------------------------

The following SDKs are installed on this computer.


You have not installed any SDK updates.

--------------------------------------------------------------------------------


Microsoft Data Access Components (Version 2.7)
Updated: February 2003
(Build 5.2.3790.0)

Build environment (Intel 64-Bit)
Sample and source code
Build environment
Documentation

--------------------------------------------------------------------------------


Common Setup Files
Updated: February 2003
(Build 5.2.3790.0)

Common Setup Files

--------------------------------------------------------------------------------


Debugging Tools for Windows
Updated: February 2003
(Build 5.2.3790.0)

Debugging tools for Windows

--------------------------------------------------------------------------------


WMI SDK
Updated: February 2003
(Build 5.2.3790.0)

Documentation
Build environment
Build environment (Intel 64-Bit)
Sample and source code

--------------------------------------------------------------------------------


Core SDK (Windows Server 2003)
Updated: February 2003
(Build 5.2.3790.0)

Build environment
Documentation (release and prerelease)
Build environment (Intel 64-bit)
Sample and source code

--------------------------------------------------------------------------------


Tablet PC SDK (Version 1.5)
Updated: February 2003
(Build 5.2.3790.0)

Sample and source code
Build environment
Documentation

--------------------------------------------------------------------------------


Register environment variables
Updated: Tuesday, April 01, 2003
(Build 5.2.3790.0)

Register environment variables

--------------------------------------------------------------------------------


Internet Development SDK (Version 6.0)
Updated: February 2003
(Build 5.2.3790.0)

Sample and source code
Documentation
Build environment

--------------------------------------------------------------------------------


Internet Information Server SDK (Version 5.1)
Updated: February 2003
(Build 5.2.3790.0)

Build environment
Sample and source code
Documentation

--------------------------------------------------------------------------------


Windows Installer SDK (Version 2.0)
Updated: February 2003
(Build 5.2.3790.0)

Build environment
Build environment (Intel 64-Bit)
Sample and source code
Documentation

--------------------------------------------------------------------------------



--------------------------------------------------------------------------------

pleasehelpme 2004-12-05
  • 打赏
  • 举报
回复
应该是缺少SDK
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
koko1998 2004-12-05
  • 打赏
  • 举报
回复
gz

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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