vs2010 编译C++ 出现的错误与解决方案

1、error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

在VS2005中生成时出错:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int,这是因为在VC6中,如果没有显示的指定返回值类型,编译器将其视为默认整型。但是vs2005不支持默认整型。解决方法如下:打开:项目----项目属性----配置属性----C/C++----命令行,在附加选项那里添加/wd4430这个选项。

2、定义函数模板的时候,

template<typename,T>

swap(T& a,T& b);

这个时候,实参的类型不能为int和double,因为再C++的std中已经定义了

template<class _Ty> inline
    void swap(_Ty& _Left, _Ty& _Right)
    {    // exchange values stored at _Left and _Right
    if (&_Left != &_Right)
        {    // different, worth swapping
        _Ty _Tmp = _Left;

        _Left = _Right;
        _Right = _Tmp;
        }
    } 
虽然swap定义成引用不能使用,但是swap定义成指针可以使用。

template<typename T>
void swap(T *a,T *b)
{
T *t;*t=*a;*a=*b;*b=*t;
}

3、关于 “error LNK2019: 无法解析的外部符号 "class std::basic_ostream...” 问题
http://blog.csdn.net/lxmuyu/article/details/7313830


4、在C++中有些库函数,比如swap,程序员在自己定义的类中重定义功能类似的函数,需要改个名字才能正确的执行。(问题:不可以用重载吗?)


5.  报错:

1>mt.exe : general error c101008a: Failed to save the updated manifest to the file "Debug\DetectionMoving.exe.embed.manifest". Bp_o_

解决方法:菜单view->class view,选中工程,右键clean饥渴。

点class view中的工程,选右鍵,再点clean就可以了; 
或者是 build->clean solusion也可以


 

报错:

1>mt.exe : general error c101008a: Failed to save the updated manifest to the file "Debug\DetectionMoving.exe.embed.manifest". Bp_o_

解决方法:

点class view中的工程,选右鍵,再点clean就可以了; 
或者是 build->clean solusion也可以



6、

(转)vs2010 warning MSB8012

 http://blog.sina.com.cn/s/blog_671c54fe0100zrbd.html

http://blog.sina.com.cn/s/blog_53d615430100uojv.html

 

So it is "Closed as Not Reproducible". Absurd. It is easily reproduced and not difficult to work around.
See the response by Li Shao at byhttp://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/beb1c32f-3893-4061-81a7-4aed4032a367
He explains exactly what causes the "warning".

Short version:
In project properties:
1) set Configuration Properties | Linker | General | Output file to$(OutDir)$(TargetName)$(TargetExt)
2) set Configuration Properties | General | Output Directory to "desired directory path"
3) set Configuration Properties | General | Target Name to "desired name for output file"
4) set Configuration Properties | General | Target Extension to "desired output file extention (include dot)"
Replace the quoted items with the appropriate values.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值