我在解决方案中新建了一个MFC的窗口程序,在工程里面添加了两个文件testApp.cpp,testApp.h,内容如下
testApp.h
#ifndef _TEST_APP_H
#define _TEST_APP_H
#include "cocos2d.h"
class TestApp : public cocos2d::Application
{
public:
TestApp();
virtual ~TestApp();
virtual bool applicationDidFinishLaunching();
virtual void applicationDidEnterBackground();
virtual void applicationWillEnterForeground();
private:
};
#endif
```
testApp.cpp:
#include "stdafx.h"
#include "testApp.h"
TestApp::TestApp()
{
}
TestApp::~TestApp()
{
}
bool TestApp::applicationDidFinishLaunching()
{
return false;
}
void TestApp::applicationWillEnterForeground()
{
}
void TestApp::applicationDidEnterBackground()
{
}
```
报错信息如下:
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\script_support\ccscriptsupport.h(326): error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> e:\software\vs2012\vc\include\string.h(191) : see declaration of 'strncpy'
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(19): error C2059: syntax error : 'constant'
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(29): error C2143: syntax error : missing ';' before '}'
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(29): error C2238: unexpected token(s) preceding ';'
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(35): error C2588: '::~ApplicationProtocol' : illegal global destructor
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(35): error C2575: 'ApplicationProtocol' : only member functions and bases can be virtual
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(35): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(35): warning C4508: 'cocos2d::ApplicationProtocol' : function should return a value; 'void' return type assumed
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(44): error C2575: 'applicationDidFinishLaunching' : only member functions and bases can be virtual
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(44): error C2072: 'cocos2d::applicationDidFinishLaunching' : initialization of a function
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(44): error C2440: 'initializing' : cannot convert from 'int' to 'bool (void)'
1> There are no conversions to function types, although there are conversions to references or pointers to functions
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(51): error C2575: 'applicationDidEnterBackground' : only member functions and bases can be virtual
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(51): error C2072: 'cocos2d::applicationDidEnterBackground' : initialization of a function
1>f:\game\cocos2d-x-3.0alpha0\cocos2dx\platform\ccapplicationprotocol.h(51): error C2440: 'initializing' : cannot convert from 'int' to 'void (void)'
………………………………………………………………………………………………………………………………………………………………………………
以同样的方式是v2.2的没有问题,开发平台:win8.1, VS2012。知道的兄弟们,告诉一声,谢谢。