library headers directory structure

Started by
6 comments, last by Puck 15 years, 2 months ago
#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]
Advertisement
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.
My mistake, I've fixed my original post.
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?
Create-ivity - a game development blog Mouseover for more information.
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.
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.
That works. The directory prefix is now ignored though, that seems odd.
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".

This topic is closed to new replies.

Advertisement