C/C++拾遗录--编程中的编译错误

来源:互联网 发布:mac里的照片导出到u盘 编辑:程序博客网 时间:2024/05/18 01:50

1.问题:error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format

解决方法:用UltraEdit查看发现好到不必要的字符。例如“?”等,去掉即可。可以在另存为成DOS格式

2.问题:error C2447: '{' : missing function header (old-style formal list?)

解决方法:原来是函数声明和函数体之间多了一个“;”

3.LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏

解决方法:该错误发生在VS2010中右键->工程属性->配置属性-> 清单工具->输入和输出->嵌入清单,选择[否]。如果程序中用到了资源文件,那么这个方法就无效了。最后使用VS2012就好了。

4.error LNK2001: 无法解析的外部符号 "protected: virtual struct AFX_MSGMAP const * __thiscall SelectDLG::GetMessageMap(void)const " (?GetMessageMap@SelectDLG@@MBEPBUAFX_MSGMAP@@XZ)

解决方法:在类中多了一个“DECLARE_MESSAGE_MAP()”。删掉就可以了。

5.1>d:\projects\detectingcovertchannels\detectingcovertchannels\detectingcovertchannelsdlg.cpp(103): error C2039: “format”: 不是“ATL::CStringT<BaseType,StringTraits>”的成员
1>          with
1>          [
1>              BaseType=wchar_t,
1>              StringTraits=StrTraitMFC_DLL<wchar_t>
1>          ]


 解决方法:这个问题出现的原因是在调用Format成员时,错用称format。而且Format调用时需要对字符串进行_T("*****")处理。 

原创粉丝点击