Visual Studio 2008中的QuickWin编译错误 [英] QuickWin Compile Errors in Visual Studio 2008

查看:130
本文介绍了Visual Studio 2008中的QuickWin编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

当我尝试构建QuickWin源代码(下载链接:http://www.codeproject.com/KB/dialog/quickwin.aspx)时,出现一些错误.几年前,我*已经*使用早期版本的Visual Studio完成了它(以相同的方式构建).

看起来应该很容易克服,但是我不确定如何继续.
这是一个很好的例子,始于:
c:\ projects \ quickwin \ quickwin \ quickwin.h(28):错误C2504:``CRedirect'':基类未定义

这是整个构建输出(顺便说一句,我*不*担心警告.):
1> ------构建开始:项目:QuickWin_Project,配置:Debug Win32 ------
1>正在编译...
1> cl:命令行警告D9035:选项"Wp64"已被弃用,并将在以后的版本中删除
1> QuickTst.cpp
1> c:\ projects \ quickwin \ quicktst \ quicktst.cpp(20):警告C4996:"gets":此函数或变量可能不安全.考虑改用gets_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ stdio.h(279):请参见声明``gets''
1> c:\ projects \ quickwin \ quicktst \ quicktst.cpp(26):警告C4996:"stricmp":不建议使用此项目的POSIX名称.而是使用符合ISO C ++的名称:_stricmp.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ string.h(215):请参见``stricmp''的声明
1> StdAfx.cpp
1> ChildView.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> c:\ projects \ quickwin \ quickwin \ quickwin.h(28):错误C2504:"CRedirect":基类未定义
1> c:\ projects \ quickwin \ quickwin \ quickwin.h(66):错误C2146:语法错误:标识符``m_WinPlace''之前缺少``;''
1> c:\ projects \ quickwin \ quickwin \ quickwin.h(66):错误C4430:缺少类型说明符-假定为int.注意:C ++不支持default-int
1> c:\ projects \ quickwin \ quickwin \ quickwin.h(66):错误C4430:缺少类型说明符-假定为int.注意:C ++不支持default-int
1> c:\ projects \ quickwin \ quickwin \ quickview.h(26):错误C2065:"BUFFER_SIZE":未声明的标识符
1> c:\ projects \ quickwin \ quickwin \ childview.cpp(17):错误C2653:"CChildView":不是类或名称空间名称
1> c:\ projects \ quickwin \ quickwin \ childview.cpp(18):错误C4430:缺少类型说明符-假定为int.注意:C ++不支持default-int
1> c:\ projects \ quickwin \ quickwin \ childview.cpp(19):警告C4508:"CChildView":函数应返回一个值;假定为"void"返回类型
1> c:\ projects \ quickwin \ quickwin \ childview.cpp(21):错误C2653:"CChildView":不是类或名称空间名称
1> c:\ projects \ quickwin \ quickwin \ childview.cpp(21):致命错误C1903:无法从以前的错误中恢复;停止编译
1> LppDlg.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> MainFrm.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> ParamDlg.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> ProcessDlg.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> QuickView.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> c:\ projects \ quickwin \ quickwin \ quickview.cpp(74):警告C4996:"strcpy":此函数或变量可能不安全.考虑改用strcpy_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ string.h(74):请参见``strcpy''的声明
1> QuickWin.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(45):警告C4996:"_ splitpath":此函数或变量可能不安全.考虑改用_splitpath_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ stdlib.h(786):请参见``_splitpath''的声明
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(63):警告C4996:"_ splitpath":此函数或变量可能不安全.考虑改用_splitpath_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ stdlib.h(786):请参见``_splitpath''的声明
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(116):警告C4267:``正在初始化'':从``size_t''转换为``int'',可能丢失数据
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(118):警告C4996:"strcpy":此函数或变量可能不安全.考虑改用strcpy_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ string.h(74):请参见``strcpy''的声明
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(120):警告C4267:``argument'':从``size_t''转换为``DWORD'',可能丢失数据
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(124):警告C4267:``argument'':从``size_t''转换为``DWORD'',可能丢失数据
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(159):警告C4267:参数":从"size_t"转换为"DWORD",可能丢失数据
1> c:\ projects \ quickwin \ quickwin \ quickwin.cpp(195):错误C2440:``static_cast'':无法从``LRESULT(__thiscall CQuickWinApp :: *)(WPARAM,LPARAM)''转换为``无效(__thiscall CWinThread :: *)(WPARAM,LPARAM)''
1>作用域中具有此名称的功能均与目标类型不匹配
1> Redirect.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> c:\ projects \ quickwin \ quickwin \ redirect.cpp(110):警告C4996:"sprintf":此函数或变量可能不安全.考虑改用sprintf_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ microsoft visual studio 9.0 \ vc \ include \ stdio.h(366):请参见"sprintf"的声明
1> c:\ projects \ quickwin \ quickwin \ redirect.cpp(395):警告C4267:正在初始化":从"size_t"转换为"DWORD",可能丢失数据
1> ToolBar.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1> c:\ projects \ quickwin \ quickwin \ toolbar.cpp(95):警告C4996:"strcpy":此函数或变量可能不安全.考虑改用strcpy_s.要禁用弃用,请使用_CRT_SECURE_NO_WARNINGS.有关详细信息,请参见在线帮助.
1> c:\ program files(x86)\ Microsoft Visual Studio 9.0 \ vc \ include \ string.h(74):请参见``strcpy''的声明
1> WinPlace.cpp
1> WINVER未定义.默认为0x0600(Windows Vista)
1>正在生成代码...
1>构建日志保存在"file://c:\ Projects \ QuickWin \ Debug \ BuildLog.htm"
1> QuickWin_Project-10个错误,15个警告
========== Build:0成功,1失败,0最新,跳过0 ==========

任何想法都表示赞赏.

Matt

Hello,

When I try to build the QuickWin source (download link: http://www.codeproject.com/KB/dialog/quickwin.aspx) I get some errors. I *have* done it (built it the same way) several years ago using an earlier version of Visual Studio.

Looks like it should be easy to overcome, but I''m not sure how to proceed.
Here''s a good example to start with:
c:\projects\quickwin\quickwin\quickwin.h(28) : error C2504: ''CRedirect'' : base class undefined

And here''s the entire build output (BTW, I am *not* worried about warnings.):
1>------ Build started: Project: QuickWin_Project, Configuration: Debug Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option ''Wp64'' has been deprecated and will be removed in a future release
1>QuickTst.cpp
1>c:\projects\quickwin\quicktst\quicktst.cpp(20) : warning C4996: ''gets'': This function or variable may be unsafe. Consider using gets_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(279) : see declaration of ''gets''
1>c:\projects\quickwin\quicktst\quicktst.cpp(26) : warning C4996: ''stricmp'': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(215) : see declaration of ''stricmp''
1>StdAfx.cpp
1>ChildView.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\projects\quickwin\quickwin\quickwin.h(28) : error C2504: ''CRedirect'' : base class undefined
1>c:\projects\quickwin\quickwin\quickwin.h(66) : error C2146: syntax error : missing '';'' before identifier ''m_WinPlace''
1>c:\projects\quickwin\quickwin\quickwin.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\quickwin\quickwin\quickwin.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\quickwin\quickwin\quickview.h(26) : error C2065: ''BUFFER_SIZE'' : undeclared identifier
1>c:\projects\quickwin\quickwin\childview.cpp(17) : error C2653: ''CChildView'' : is not a class or namespace name
1>c:\projects\quickwin\quickwin\childview.cpp(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\projects\quickwin\quickwin\childview.cpp(19) : warning C4508: ''CChildView'' : function should return a value; ''void'' return type assumed
1>c:\projects\quickwin\quickwin\childview.cpp(21) : error C2653: ''CChildView'' : is not a class or namespace name
1>c:\projects\quickwin\quickwin\childview.cpp(21) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>LppDlg.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>MainFrm.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>ParamDlg.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>ProcessDlg.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>QuickView.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\projects\quickwin\quickwin\quickview.cpp(74) : warning C4996: ''strcpy'': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of ''strcpy''
1>QuickWin.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\projects\quickwin\quickwin\quickwin.cpp(45) : warning C4996: ''_splitpath'': This function or variable may be unsafe. Consider using _splitpath_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdlib.h(786) : see declaration of ''_splitpath''
1>c:\projects\quickwin\quickwin\quickwin.cpp(63) : warning C4996: ''_splitpath'': This function or variable may be unsafe. Consider using _splitpath_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdlib.h(786) : see declaration of ''_splitpath''
1>c:\projects\quickwin\quickwin\quickwin.cpp(116) : warning C4267: ''initializing'' : conversion from ''size_t'' to ''int'', possible loss of data
1>c:\projects\quickwin\quickwin\quickwin.cpp(118) : warning C4996: ''strcpy'': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of ''strcpy''
1>c:\projects\quickwin\quickwin\quickwin.cpp(120) : warning C4267: ''argument'' : conversion from ''size_t'' to ''DWORD'', possible loss of data
1>c:\projects\quickwin\quickwin\quickwin.cpp(124) : warning C4267: ''argument'' : conversion from ''size_t'' to ''DWORD'', possible loss of data
1>c:\projects\quickwin\quickwin\quickwin.cpp(159) : warning C4267: ''argument'' : conversion from ''size_t'' to ''DWORD'', possible loss of data
1>c:\projects\quickwin\quickwin\quickwin.cpp(195) : error C2440: ''static_cast'' : cannot convert from ''LRESULT (__thiscall CQuickWinApp::* )(WPARAM,LPARAM)'' to ''void (__thiscall CWinThread::* )(WPARAM,LPARAM)''
1> None of the functions with this name in scope match the target type
1>Redirect.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\projects\quickwin\quickwin\redirect.cpp(110) : warning C4996: ''sprintf'': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of ''sprintf''
1>c:\projects\quickwin\quickwin\redirect.cpp(395) : warning C4267: ''initializing'' : conversion from ''size_t'' to ''DWORD'', possible loss of data
1>ToolBar.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>c:\projects\quickwin\quickwin\toolbar.cpp(95) : warning C4996: ''strcpy'': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of ''strcpy''
1>WinPlace.cpp
1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
1>Generating Code...
1>Build log was saved at "file://c:\Projects\QuickWin\Debug\BuildLog.htm"
1>QuickWin_Project - 10 error(s), 15 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Any ideas are appreciated.

Matt

推荐答案

我建​​议您更改代码-旧的格式,字符串和内存函数已替换为较安全的版本,试图保护您免受缓冲区溢出的影响.另一种方法是在项目级别#define _CRT_SECURE_NO_WARNINGS = 1.

似乎您需要定义WINVER-也许#define WINVER 0x0601

至于CRedirect,您需要深入研究代码,也许另一个缺少的定义会阻止其被包含.

最好的问候
Espen Harlinn
I would suggest that you change the code - the old formatting, string and memory functions has been replaced with safer versions that tries to protect you from buffer overruns. The alternative is to #define _CRT_SECURE_NO_WARNINGS=1 at the project level.

It seems that you need to define WINVER - perhaps #define WINVER 0x0601

As for the CRedirect, you need to dig into the code, perhaps another missing define prevents it from being included.

Best regards
Espen Harlinn


我想您是从头开始制定自己的解决方案,而不是升级现有解决方案.

实际项目中未使用ChildView.h和ChildView.cpp.从解决方案中删除它们.

完成此操作后,只需更改一件事. Microsoft更改了注册线程消息的实现方式,并且不再需要返回值.以下是您需要对其进行编译的唯一更改.

QuickWin.h
I am going to guess that you made your own solution from scratch, rather than upgrade the existing one.

ChildView.h and ChildView.cpp are not used in the actual project. Remove these from your solution.

Once you have done that, there is only 1 thing that needs changing. Microsoft changed the way registered thread messages are implemented, and a return value is no longer needed. Below are the only changes you should need to make to get it compiling.

QuickWin.h
//Line 102: Change
//afx_msg LRESULT OnStdioCommand(WPARAM wParam, LPARAM lParam);
afx_msg void OnStdioCommand(WPARAM wParam, LPARAM lParam);



QuickWin.cpp



QuickWin.cpp

//Line 420: Change
//LRESULT CQuickWinApp::OnStdioCommand(WPARAM wCommand, LPARAM lParam)
void CQuickWinApp::OnStdioCommand(WPARAM wCommand, LPARAM lParam)

//Line 454: Delete
//return 0;




我实际上无法让它做任何有用的事情,因此肯定还有其他需要更改的地方,但是我没有时间去搜索它.希望对您有所帮助.




I couldn''t actually get it to do anything useful, so there must be something else that needs changing too, but I don''t have the time to search for it. Hope this much helps.


这篇关于Visual Studio 2008中的QuickWin编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆