## Recommended Posts

#include <al/alc.h>
#include <al/alut.h>


Visual C express complains because alc.h is linked within alut.h without the "al" directory. What's the proper way to address this issue without altering the alut.h file or moving alc.h? [Edited by - avocados on January 19, 2009 5:18:37 PM]

##### Share on other sites
Usually you don't #include your .c or .cpp files.
Are you 100% positive that you need to include the .c file? Because I'm 90% sure you shouldn't.

##### Share on other sites
My mistake, I've fixed my original post.

##### Share on other sites
So, in other words, alut.h already includes alc.h? In that case, you only need to include al/alut.h. If that's not the case, then exactly what error messages do you get?

##### Share on other sites
Error:
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\al/alut.h(5) : fatal error C1083: Cannot open include file: 'alc.h': No such file or directory

alut.h includes <alc.h> instead of <al/alc.h> like I'm using. For now I've put it where it wants but I sure would like to understand how this works.

##### Share on other sites
the way to solve your problem without altering any files is to include "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\al\" in your include search directories list. I'm not familiar with Visual Studio, so you'll have to consult the documentation or someone else for the exact process, but that should point you in the right direction.

Essentially the idea is that when you include a file, the compiler takes a list of directories and searches for the path you specified in each until it finds the file, and spits out an error if it exhausts the list without finding the file, which is what's happening here.

The compiler sees your include of "al/alut.h" and goes through its list until it finds "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\al/alut.h", then it processes that file and finds the include of "alc.h", whereupon the compiler starts over at the beginning of its list, but it can't find "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\alc.h" so it spits out an error.

If you add "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\al\" to the directory list, the compiler will, in perusing its list, check for "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\al\alc.h" where the file actually exists.

##### Share on other sites
That works. The directory prefix is now ignored though, that seems odd.

##### Share on other sites
That's because both "Include\" and "Include\al\" are in the list. If you include "al/alut.h" it won't be able to find "Include\al\al/alut.h" but it can find "Include\al/alut.h", so it uses that. Conversely if you omit the directory, it can't find "Include\alut.h" but it can find "Include\al\alut.h".

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628400
• Total Posts
2982449

• 9
• 10
• 9
• 19
• 24