## Recommended Posts

A lot of SDL structs (not just SDL_Thread) are declared in a header and defined in a the source code (but in a .h file). But i get the following error using Visual Studio 2005:
c:\...ballistic\src\thread\Thread.h(40) : error C2027: use of undefined type 'SDL_Thread'
c:\...\sdl\SDL_thread.h(44) : see declaration of 'SDL_Thread'
How can i fix this error? thanks [Edited by - XTAL256 on May 16, 2008 10:53:05 PM]

##### Share on other sites
I realised that i had code to access the thread id (thread->threadid). I didn't really need it so i deleted it and the compiler stopped complaining. But what if i needed to access a member of SDL_Thread? Are they meant to be private variables since they're only defined in the source and not the main header files.

##### Share on other sites
I'm not entirely sure I know what you're trying to do.

This below creates a thread for your.
SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);

SDL_Thread itself isn't entirely clear in the SDL API Reference, which I'm surprised since it's usually clear on 99.9% of my problems I have in SDL, but it's a structure much like SDL_Image, or SDL_Rect

so to access it's variables just do

Look into the SDL API Reference to assist you in this manner if I'm not clear enough. Reading the API thoroughly and keeping it handy with you as you make your projects will definitely help out in the long run.

Good Luck! ;)

p.s. I see this is your ballistic game. Can I join?

##### Share on other sites
I didn't really make it clear in my last post, but i fixed the problem. See, because SDL_Thread is only declared in SDL_thread.h, the compiler doesn't know what member variables it has. In that sense, they are private. But it's ok because i never needed to access them anyway.

Quote:
 p.s. I see this is your ballistic game. Can I join?

Yeah, sure, i am always looking for help. I will pm you.

## Create an account

Register a new account