Problem with Code?

edited March 2012 in Help request
Well, despite not being part of the ORX community for very long, I've managed to come across quite a few issues. :P

I've been following Grey's third tutorial, but whenever I build it I get this error:
1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
1>Compiling...
1>StandAlone.cpp
1>c:orx_msvs_2008-devproject1standalone.cpp(1) : error C2146: syntax error : missing ';' before identifier 'orxFASTCALL'
1>c:orx_msvs_2008-devproject1standalone.cpp(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:orx_msvs_2008-devproject1standalone.cpp(1) : error C2653: 'StandAlone' : is not a class or namespace name
1>c:orx_msvs_2008-devproject1standalone.cpp(1) : error C2146: syntax error : missing ';' before identifier 'Init'
1>c:orx_msvs_2008-devproject1standalone.cpp(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:orx_msvs_2008-devproject1standalone.cpp(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C3861: 'orxViewport_CreateFromConfig': identifier not found
1>c:orx_msvs_2008-devproject1standalone.cpp(4) : error C3861: 'orxConfig_Load': identifier not found
1>c:orx_msvs_2008-devproject1standalone.cpp(6) : error C3861: 'orxObject_CreateFromConfig': identifier not found
1>c:orx_msvs_2008-devproject1standalone.cpp(8) : error C2065: 'orxStatus_SUCCESS' : undeclared identifier
1>Build log was saved at "file://c:ORX_msvs_2008-devProject1DebugBuildLog.htm"
1>Project1 - 10 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Sorry if I trouble you, but this is the best place to turn to! :D

Comments

  • edited March 2012
    No worries, that's what the forum is for! :)

    Well, it looks like some kind of syntax error in your file. It'd be helpful if you could paste the content of your source file here, without that there isn't much we can do. :)
  • edited March 2012
    The code, or what's in the folder?
  • edited March 2012
    source file = your code :)
  • edited March 2012
    StaticScene.ini
    [Scene] ;=====================================
    ChildList            = Soldier
    
    [Soldier] ;===================================
    ChildList            = SoldierGraphics#SoldierNameTag
    
    [SoldierPivot] ;==============================
    Pivot                = (16.0, 16.0, 0.0)     ; Move to centre of image on X axis, bottom of image on Y axis (Soldier's feet!)
     
    [SoldierGraphics@SoldierPivot] ;==============
    Graphic              = StoppedFrame
     
    [StoppedFrame] ;==============================
    Texture              = ../data/anim/soldier.png
    TextureSize          = (32, 32, 0)
    
    [SoldierNameTag] ;============================
    Graphic              = SoldierName
    Position             = (0.0, -32.0, 0.0)
     
    [SoldierName] ;===============================
    Text                 = SoldierNameString
    Color                = (255, 255, 255)
    Pivot                = center
     
    [SoldierNameString] ;=========================
    String               = Soldier
    

    StandAlone.cpp
    orxSTATUS orxFASTCALL StandAlone::Init()
    {
    	orxViewport_CreateFromConfig( "Viewport" );
    	orxConfig_Load( "StaticScene.ini" );
    
    	orxObject_CreateFromConfig( "Scene" );
    
    	return orxStatus_SUCCESS;
    

    That's what the tutorial told me to put, I think.
  • edited March 2012
    The return code must be spelled with the proper case orxSTATUS_SUCCESS
  • edited March 2012
    What acksys said.
    Also you have no include to a header file that would define your StandAlone C++ class. Right now your compiler has no idea what the StandAlone class is.

    I believe Grey's tutorials are iterative and he goes through the class declaration in his tutorial #2.
  • edited March 2012
    Hmm.
    Not entirely sure how to fix it, I used your suggestions and got this error code:
    1>------ Build started: Project: Project1, Configuration: Debug Win32 ------
    1>Compiling...
    1>StandAlone.cpp
    1>c:orx_msvs_2008-devproject1staticscene.ini(1) : error C2337: 'Scene' : attribute not found
    1>c:orx_msvs_2008-devproject1staticscene.ini(2) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(4) : error C2065: 'Soldier' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(4) : error C2065: 'Soldier' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(5) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(5) : error C2374: 'ChildList' : redefinition; multiple initialization
    1>        c:orx_msvs_2008-devproject1staticscene.ini(2) : see declaration of 'ChildList'
    1>c:orx_msvs_2008-devproject1staticscene.ini(5) : error C2014: preprocessor command must start as first nonwhite space
    1>c:orx_msvs_2008-devproject1staticscene.ini(7) : error C2065: 'SoldierGraphics' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(7) : error C2065: 'SoldierPivot' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'to'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'centre'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'of'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'image'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'on'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'X'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'axis'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'of'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'image'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2086: 'int of' : redefinition
    1>        c:orx_msvs_2008-devproject1staticscene.ini(8) : see declaration of 'of'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'on'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2086: 'int image' : redefinition
    1>        c:orx_msvs_2008-devproject1staticscene.ini(8) : see declaration of 'image'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'Y'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2086: 'int on' : redefinition
    1>        c:orx_msvs_2008-devproject1staticscene.ini(8) : see declaration of 'on'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2146: syntax error : missing ';' before identifier 'axis'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2001: newline in constant
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2015: too many characters in constant
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2065: 'Soldier' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2143: syntax error : missing ')' before 'constant'
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(8) : error C2086: 'int axis' : redefinition
    1>        c:orx_msvs_2008-devproject1staticscene.ini(8) : see declaration of 'axis'
    1>c:orx_msvs_2008-devproject1staticscene.ini(10) : error C2018: unknown character '0x40'
    1>c:orx_msvs_2008-devproject1staticscene.ini(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(13) : error C2065: 'StoppedFrame' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(13) : error C2065: 'StoppedFrame' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(14) : error C2059: syntax error : '.'
    1>c:orx_msvs_2008-devproject1staticscene.ini(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(18) : error C2374: 'Graphic' : redefinition; multiple initialization
    1>        c:orx_msvs_2008-devproject1staticscene.ini(11) : see declaration of 'Graphic'
    1>c:orx_msvs_2008-devproject1staticscene.ini(19) : error C2065: 'SoldierName' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(19) : error C2146: syntax error : missing ';' before identifier 'Position'
    1>c:orx_msvs_2008-devproject1staticscene.ini(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(21) : error C2065: 'SoldierName' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(23) : error C2065: 'SoldierNameString' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(23) : error C2146: syntax error : missing ';' before identifier 'Color'
    1>c:orx_msvs_2008-devproject1staticscene.ini(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(24) : error C2146: syntax error : missing ';' before identifier 'Pivot'
    1>c:orx_msvs_2008-devproject1staticscene.ini(24) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1staticscene.ini(24) : error C2374: 'Pivot' : redefinition; multiple initialization
    1>        c:orx_msvs_2008-devproject1staticscene.ini(8) : see declaration of 'Pivot'
    1>c:orx_msvs_2008-devproject1staticscene.ini(26) : error C2065: 'center' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(26) : error C2065: 'SoldierNameString' : undeclared identifier
    1>c:orx_msvs_2008-devproject1staticscene.ini(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C2065: 'Soldier' : undeclared identifier
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C2146: syntax error : missing ';' before identifier 'orxSTATUS'
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C2146: syntax error : missing ';' before identifier 'orxFASTCALL'
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C2653: 'StandAlone' : is not a class or namespace name
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C2146: syntax error : missing ';' before identifier 'Init'
    1>c:orx_msvs_2008-devproject1standalone.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1standalone.cpp(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:orx_msvs_2008-devproject1standalone.cpp(5) : error C3861: 'orxViewport_CreateFromConfig': identifier not found
    1>c:orx_msvs_2008-devproject1standalone.cpp(6) : error C3861: 'orxConfig_Load': identifier not found
    1>c:orx_msvs_2008-devproject1standalone.cpp(8) : error C3861: 'orxObject_CreateFromConfig': identifier not found
    1>c:orx_msvs_2008-devproject1standalone.cpp(10) : error C2065: 'orxSTATUS_SUCCESS' : undeclared identifier
    1>Build log was saved at "file://c:ORX_msvs_2008-devProject1DebugBuildLog.htm"
    1>Project1 - 78 error(s), 1 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

    Code looks like:
    StaticScene.ini:
    [size=2][Scene];
    ChildList            = Soldier
    
    [Soldier];
    ChildList            = SoldierGraphics#SoldierNameTag
    
    [SoldierPivot];
    Pivot                = (16.0, 16.0, 0.0)     ; Move to centre of image on X axis, bottom of image on Y axis (Soldier's feet!)
     
    [SoldierGraphics@SoldierPivot];
    Graphic              = StoppedFrame
     
    [StoppedFrame];
    Texture              = ../data/anim/soldier.png
    TextureSize          = (32, 32, 0)
    
    [SoldierNameTag];
    Graphic              = SoldierName
    Position             = (0.0, -32.0, 0.0)
     
    [SoldierName];
    Text                 = SoldierNameString
    Color                = (255, 255, 255)
    Pivot                = center
     
    [SoldierNameString];
    String               = Soldier[/size]
    

    StandAlone.cpp:
    #include "StaticScene.ini"
    
    orxSTATUS orxFASTCALL StandAlone::Init()
    {
    	orxViewport_CreateFromConfig( "Viewport" );
    	orxConfig_Load( "StaticScene.ini" );
    
    	orxObject_CreateFromConfig( "Scene" );
    
    	return orxSTATUS_SUCCESS;
    }
    

    EDIT: Holy crap! I didn't realize that the build message was so big! D:
  • edited March 2012
    Hello ChaoticCactus,
    As Iarwain already said, my tutorials are iterative. You have to have completed tutorial 1 in order to have all the required pieces for tutorial 2, and so on. You cannot simply copy a small chunk of tutorial 3 and expect it to work unfortunately.

    Each tutorial builds on a collection of code and ini modifications from the previous tutorial.

    The reason your code won't compile, is because you don't have any of the OTHER code that is needed.

    Start at tutorial 1, and follow the steps -- that way you will have a -working- example with more and more structure included at the end of each one.

    Good luck! :)
  • edited March 2012
    Oooh.

    I see now!

    Well, thanks all!
    :P
Sign In or Register to comment.