Results 1 to 10 of 10

Thread: 'CL_SetupSound' : undeclared identifier

  1. #1

    Default 'CL_SetupSound' : undeclared identifier

    I'm reading a book called "Introduction to Game programming with C++" and in the 2d section in that book i'm supposed to use clanlib. Supposedly this code creates a simple window. However it says that some identifers are undeclared, 'CL_SetupSound' and 'setup_sound'. Is it some header file he never told me to include that i have to include? Or is it something else?

    This is the code supplied to me by the book.

    #include "stdafx.h"
    #include "clanlibtest.h"

    #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);


    return 0;
    }
    }app;


    Errors:
    error C2065: 'CL_SetupSound' : undeclared identifier
    error C2146: syntax error : missing ';' before identifier 'setup_sound'
    error C2065: 'setup_sound' : undeclared identifier

    Thanks in advance for any help
    P.S: I'm using visual studio 2008

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    If you require sound - Add:
    #include <ClanLib/sound.h>

    If you don't require sound - Remove:
    CL_SetupSound setup_sound;

    I assume that the book was written for ClanLib less that 0.8, so there may be subtle differences.

    Clanlib 0.8 - Current Release
    Clanlib 0.9 - Development (almost a rewrite)

    In the future, ClanLib 0.8 is to be released as ClanLib 1.0
    In the future, ClanLib 0.9 is to be released as ClanLib 2.0
    Last edited by rombust; 02-17-2009 at 01:10 PM. Reason: Clarification

  3. #3

    Default

    Thanks that worked
    However, now i'm getting another error.

    cannot open file 'clanApp-static-mt-debug.lib'

    I looked in the folder where i told all install files to go and i found

    clanapp-static-mt-debug.idb

    and

    clanapp-static-mt-debug.pdb

    But no file with that name that ended with a .lib

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

    Default

    Hm..I remember I fixed some clanApp* issues in ClanLib-0.9 - maybe we still have that problem in 0.8.

    Do you have files named clanApplication* instead in your library path? If not, did the compilation of ClanLib go ok?

  5. #5

    Default

    These are all the files i have, and the compilation returned no errors.

    http://img21.imageshack.us/img21/1599/clanlibtz6.jpg

  6. #6

    Default

    I searched for that file on my computer and for some weird reason i found it in the trashcan, i put it in the appropriate folder and now i got a whole bunch of errors.

    http://img502.imageshack.us/img502/1244/clanlibgy0.jpg

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    It's strange that clanApp was deleted, it must have been an accident.

    Anyway, the error...

    From http://clanlib.org/docs/clanlib-0.9....dows-msvc.html

    "This is almost always caused by mixing runtime versions. Your project is most likely set to Multithreaded Debug DLL, while ClanLib expects it to be Multithreaded Debug. Fixed by going to the project settings of your project and set it to what ClanLib expects."

  8. #8

    Default

    Now this is what i get :P

    1>ClanLibTest2.obj : error LNK2019: unresolved external symbol "public: __thiscall cClanLibApp::cClanLibApp(void)" (??0cClanLibApp@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'app''(void)" (??__Eapp@@YAXXZ)

    1>ClanLibTest2.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cClanLibApp::~cClanLibApp(void)" (??1cClanLibApp@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'app''(void)" (??__Fapp@@YAXXZ)

    1>C:\Documents and Settings\Jonathan\Skrivbord\Introduction To Game Porgramming with C++, Ívningar\ClanLibTest2\Debug\ClanLibTest2.exe : fatal error LNK1120: 2 unresolved externals

  9. #9
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    That's a simple one

    You forgot to create the cClanLibApp constructor and destructors.

    Add at the bottom of the code:

    cClanLibApp::cClanLibApp()
    {
    }

    cClanLibApp::~cClanLibApp()
    {
    }

    If you encounter any further problems, Ensure that the Basic2d example works (Examples/Basic2D)

  10. #10

    Default

    Yeah that worked lol, thanks :P

    I'm gonna ditch this book though because it's either outdated or the code supplied is wrong -.-

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
  •