LNK 2019 error when i create a new scene. WIN32

LNK 2019 error when i create a new scene. WIN32
0

Whenever i try to call the create() function included in cocos2d I get a LNK2019 error Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “public: static class cocos2d::Scene * __cdecl startScene::createScene(void)” (?createScene@startScene@@SAPAVScene@cocos2d@@XZ) referenced in function “class cocos2d::Scene * __cdecl createScene(void)”

My code for the new scene is:
Header file:

      #ifndef __START_SCENE_H__
     #define __START_SCENE_H__
 
     #include "cocos2d.h"
 
     class startScene : public cocos2d::Scene
     {
     public:
     	static cocos2d::Scene* createScene();
 
     	virtual bool init();
     	void menuCloseCallback(cocos2d::Ref* pSender);
 
     	CREATE_FUNC(startScene);
     };
 
     #endif

My CPP file:

#include "startScene.h"

cocos2d::Scene* createScene()
{
	return startScene::create();
}

bool startScene::init()
{

	return true;
}


void startScene::menuCloseCallback(Ref* pSender)
{
	cocos2d::Director::getInstance()->end();
}

In Cpp instead of this:

write this:

cocos2d::Scene* startScene::createScene()
2 Likes

Oh my god. I feel like such a idiot for missing that lol i spent hours looking for what was going wrong. Thank you so much.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.