About Store Forum Documentation Contact



Post Reply 
Statate Intro ---> State Game ----> Error
Author Message
Krzysiek1105 Offline
Member

Post: #1
Statate Intro ---> State Game ----> Error
Hello.
After adding the code errors occur.

Quote:1>Main.obj : error LNK2001: unresolved external symbol "struct EE::State StateGame" (?StateGame@@3UState@EE@@A)
1>Renascence.exe : fatal error LNK1120: 1 unresolved externals

Piece of code:

Quote:/******************************************************************************/
extern State StateIntro,StateGame;
/******************************************************/

Bool InitIntro(){return true;}
void ShutIntro(){}
Bool UpdateIntro()
{
if(Kb.bp(KB_ENTER))StateGame.set(0.1); // then switch to 'StateMenu' state with 1.0 second smooth fading
return true;
}
void DrawIntro()
{
D.clear(BLACK);
D.text (0,0,"Intro");
}
State StateIntro(UpdateIntro,DrawIntro,InitIntro,ShutIntro);
/****************************************************************************/
11-26-2009 07:09 AM
Find all posts by this user Quote this message in a reply
Harton Offline
Member

Post: #2
RE: Statate Intro ---> State Game ----> Error
You don`t declare state StateGame.
You wrote
Code:
extern State StateIntro,StateGame;
but where is
Code:
State StateGame(UpdateGame, DrawGame, InitGame, ShutGame);
(This post was last modified: 11-26-2009 10:25 AM by Harton.)
11-26-2009 10:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Krzysiek1105 Offline
Member

Post: #3
RE: Statate Intro ---> State Game ----> Error
I did like this:

Quote:/******************************************************************************/
Bool InitIntro(){return true;}
void ShutIntro(){}
Bool UpdateIntro()
{
if(Kb.bp(KB_ENTER))StateGame.set(0.1);
return true;
}
void DrawIntro() //rysuj intro
{
D.clear(BLACK);
D.text (0,0,"Intro");
}
/********************************************************************************​****************************************/
State StateIntro(UpdateIntro,DrawIntro,InitIntro,ShutIntro);
Bool InitGame(){return true;}
void ShutGame(){}
Bool UpdateGame()
{
if(Kb.bp(KB_ESC))StateIntro.set(0.1); // jeżeli wcisnę ESC wroci mnie do intra
return true;
}
State StateGame(InitGame,UpdateGame,ShutGame);



Error:
Quote:1>d:\renascence\source\main.cpp(38) : error C2664: 'EE::State::State(Bool (__cdecl *)(void),void (__cdecl *)(void),Bool (__cdecl *)(void),void (__cdecl *)(void))' : cannot convert parameter 2 from 'Bool (__cdecl *)(void)' to 'void (__cdecl *)(void)'
(This post was last modified: 11-26-2009 12:31 PM by Krzysiek1105.)
11-26-2009 12:31 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #4
RE: Statate Intro ---> State Game ----> Error
Check tutorial Projects/Simple project
11-26-2009 02:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Krzysiek1105 Offline
Member

Post: #5
RE: Statate Intro ---> State Game ----> Error
Next I have error.

Quote:1>------ Build started: Project: Renascence, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>d:\renascence\source\main.cpp(56) : error C2664: 'EE::State::State(Bool (__cdecl *)(void),void (__cdecl *)(void),Bool (__cdecl *)(void),void (__cdecl *)(void))' : cannot convert parameter 2 from 'Bool (__cdecl *)(void)' to 'void (__cdecl *)(void)'
1> None of the functions with this name in scope match the target type
1>Build log was saved at "file://d:\Renascence\Debug\BuildLog.htm"
1>Renascence - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
(This post was last modified: 11-26-2009 05:43 PM by Krzysiek1105.)
11-26-2009 03:00 PM
Find all posts by this user Quote this message in a reply
Post Reply