Results 1 to 5 of 5

Thread: Building my first app in ClanLib (Cannot display game window)

  1. #1

    Default Building my first app in ClanLib (Cannot display game window)

    Hello everyone! I am reading a book that is trying to teach me the basics of programming in c++(this is the first language I am trying to learn), and I am trying to build a simple application and I am running into a few errors. What I have built so far should be displaying an empty blue game window, and allowing it to stay open until the ESC key is pressed. Here is the start of the app:

    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/display.h>
    #include <ClanLib/gl.h>
    #include <ClanLib/application.h>
    
    //Main App Class
    class cClanLibApp : public CL_ClanApplication	
    {
    	public:
    		cClanLibApp();
    		~cClanLibApp();
    
    		virtual int main(int, char **)
    		{
    			CL_SetupCore setup_core;
    			CL_SetupDisplay setup_display;
    			CL_SetupGL setup_gl;
    			CL_SetupSound setup_sound;
    
    			CL_DisplayWindow window("Test", 640, 480);
    
    			//Enter game loop
    			while(!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
    			{
    				CL_Display::clear(CL_Color(0, 0, 0, 255));
    				UpdateFrames();
    				CL_Display::flip();
    				CL_System::sleep(10);
    				CL_System::keep_alive();
    			}
    			return 0;
    		}
    }app;


    And here are the errors that I am getting when I try to debug and build it:

    1>.\My First App.cc(18) : error C2065: 'CL_SetupSound' : undeclared identifier
    1>.\My First App.cc(18) : error C2146: syntax error : missing ';' before identifier 'setup_sound'
    1>.\My First App.cc(18) : error C2065: 'setup_sound' : undeclared identifier
    1>.\My First App.cc(23) : error C2653: 'CL_Keyboard' : is not a class or namespace name
    1>.\My First App.cc(23) : error C3861: 'get_keycode': identifier not found
    1>.\My First App.cc(25) : error C2039: 'clear' : is not a member of 'CL_Display'
    1> c:\development\environment\include\clanlib\Display/display.h(49) : see declaration of 'CL_Display'
    1>.\My First App.cc(25) : error C3861: 'clear': identifier not found
    1>.\My First App.cc(26) : error C3861: 'UpdateFrames': identifier not found
    1>.\My First App.cc(27) : error C2039: 'flip' : is not a member of 'CL_Display'
    1> c:\development\environment\include\clanlib\Display/display.h(49) : see declaration of 'CL_Display'
    1>.\My First App.cc(27) : error C3861: 'flip': identifier not found
    1>.\My First App.cc(29) : error C2039: 'keep_alive' : is not a member of 'CL_System'
    1> c:\development\environment\include\clanlib\core\sy stem\system.h(53) : see declaration of 'CL_System'
    1>.\My First App.cc(29) : error C3861: 'keep_alive': identifier not found


    Any idea what I am doing wrong. I know it is probably a rookie mistake, but that's exactly what I am so any help would be appreciated! Thanks!

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    The API between ClanLib 1.0 and 2.0 are different. It seems you are coding 1.0 syntax, but using ClanLib 2.0.

    Regarding the sound error, you forgot to include <ClanLib/sound.h>

  3. #3

    Default

    Thanks again sphair!

    so how do I learn the syntax for 2.0? Is there a help guide or something? Or is it possible for me to downgrade my software so that I can continue to work with the book I am reading? Any suggestions?

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    The book was written for ClanLib 1.0, which you can download from our download page.

    It is probably better you download and install that version, since our overview pages assume that you are a bit more used to C++ than you seem to be at this point. I.e. the include error is something that should be able to guess on your own when you're bit more used to seeing errors caused by missing includes.

    Most of the stuff you learn about 1.0 you can still use if you later decide to try upgrade to 2.0, so working with 1.0 while reading this book is in no way a waste.

  5. #5

    Default

    Thanks Magnus Norddahl! I think I saw your name as one of the code authors in ClanLib (I didn't realize that ClanLib Developer title meant you guys really built ClanLib! Thanks for the great SDK!) I will download the ClanLib 1.0 software now. Should I delete all the ClanLib files I have a the moment?

    By the way, you are absolutely right! I am very new to this. I just started school for game design and I decided to teach myself some programming to get ahead. So far I love it, but at times the set-up can be difficult! I really appreciate this site, you folks are very helpful!

Similar Threads

  1. Newton Game Dynamics and clanLib?
    By alexv1 in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 02-19-2009, 07:39 AM
  2. cl_displaywindow refuses to display a window
    By dwune in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 10-01-2007, 04:01 PM
  3. Problem building ClanLib
    By jtaylor1126 in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 03-31-2007, 12:10 AM
  4. Problems building clanGUI
    By mgarcia in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 12-15-2006, 03:22 PM
  5. Game loads but display is all black.
    By diggisaur in forum Other RTsoft Games
    Replies: 6
    Last Post: 03-28-2003, 05:53 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •