Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

878340 Posts in 32917 Topics- by 24330 Members - Latest Member: Mustaklaki

May 21, 2013, 04:43:21 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Issues with sal.h
Pages: [1]
Print
Author Topic: Issues with sal.h  (Read 415 times)
Zdrok
Level 0
*


ᶰᵒ


View Profile
« on: February 06, 2012, 01:21:40 PM »

I'm trying to implement DirectSound since the stock windows sound functions are pretty limited.  I needed to include dsound.h, which also grabbed sal.h as an include.  Without sal.h, dsound.h gets loads of errors.  But with sal.h, a whole bunch of errors come up spread throughout my own code that don't appear if I just comment out #include <dsound.h>.  They seem to pop up around lines that involve pointers.  Here are a few:

Code:
pEnt=NULL; //pEnt is an Entity *, Entity is a custom class

if(pEnt!=NULL)

if(pTarget!=NULL) {pTarget->Deactivate();} //pTarget is an Object *, Object is a custom class

PlaySound("snd/geteq.wav",NULL,SND_FILENAME | SND_ASYNC); //String is a series of pointers, right?

if(elist[0]!=NULL) //elist is an array of Entity *'s

if(pEnt->ai_tEnt!=NULL) //pEnt is an Entity *, ai_tEnt is also an Entity *
(These lines are not in order, they're throughout several files.)

The error is always some variant of "Expected primary-expression before '[some character]' token"

Does sal.h add some new syntax requirements or something?  Does anybody have experience with this type of issue?
Logged
HernanZh
Level 2
**


hernizhou@hotmail.com
View Profile WWW Email
« Reply #1 on: February 06, 2012, 01:33:19 PM »

If you get a ton of errors, always look up the first one and work from there. Ignore the rest, the other errors may be generated because of the first one.
Logged

Zdrok
Level 0
*


ᶰᵒ


View Profile
« Reply #2 on: February 06, 2012, 01:39:11 PM »

I posted the first one or two from a couple different file compilations, so they're independent.  But the main issue here isn't with subtle errors, this compiles completely fine without sal.h.  It's some requirement that sal.h adds.
Logged
rivon
Level 10
*****



View Profile
« Reply #3 on: February 06, 2012, 01:53:13 PM »

Maybe "sal.h" defines classes/functions which overshadow (I dunno the right term) your classes/functions. (They have the same name but not the same functions, data etc.)
Logged
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #4 on: February 06, 2012, 02:01:59 PM »

This does sound like conflicting symbols. F.i. the "pTarget" and "pEnt" variables might be defined in sal.h. Also check out the "PlaySound" function, which has exactly the kind of generic name that could conflict with other includes.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Zdrok
Level 0
*


ᶰᵒ


View Profile
« Reply #5 on: February 06, 2012, 03:09:35 PM »

PlaySound is a Windows command, so I doubt there'd be a conflict there since sal.h is by windows as well.  Both pEnt and pTarget never appear in dsound.h or sal.h, either.  I think sal.h requires that I use annotations in every argument of every function, but I have no idea what they are or how to use them and I don't really want them.  Does anyone know of a way to use DirectSound without all this hassle, or some way to disable sal.h while still using dsound.h?
Logged
Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW Email
« Reply #6 on: February 06, 2012, 03:15:44 PM »

The one thing that seems to be common in all of those lines in NULL.  Definitions of NULL can be really funny, sometimes headers feel like declaring their own versions.

Try replacing all of the NULLs with 0 and see if that helps.
Logged

Franchise - The restaurant wars begin!

What would John Carmack do?
Zdrok
Level 0
*


ᶰᵒ


View Profile
« Reply #7 on: February 06, 2012, 03:24:45 PM »

That fixed it.  Thanks, I've been stuck on this for days.  Is this going to be an issue later?  NULL seemed useful, is there anything serious that I will need it for?
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic