Sign in to follow this  
XTAL256

SDL thread 'undefined' *SOLVED*

Recommended Posts

XTAL256    106
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 this post


Link to post
Share on other sites
XTAL256    106
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 this post


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

SDL_thread.h is just the header file needed to be added to your project to work with threads using the SDL library.

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

SDL_Thread.variable_name = variable value


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 this post


Link to post
Share on other sites
XTAL256    106
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this