   Nightmare compilation error!
  Hi all, this problem is driving me crazy...Basically, I have a library that has math structures/functions and model loading classes. The directory structure is this:/include/sheeplib/math/vec3.h/include/sheeplib/math/vec2.h/include/sheeplib/model/model.hNow, I can compile the library perfectly fine with no problems. When I compile the library I add the /include/sheeplib/ directory to the search directories and all #includes use math/vec3.h or model/model.h etc.Now when it comes to using the library I get the following error in model.h:"slVec3 does not name a type"Here is that section of code:#include "../math/vec2.h"#include "../math/vec4.h"#include "../math/vec3.h"using std::vector;using std::map;using std::string;namespace sheeplib {    namespace model {typedef unsigned int SLuint;struct ModelTriangle {slVec3 m_Normal;slVec2 m_TexCoords[3];SLuint m_MaterialID;};The error occurs on the m_Normal line. vec3.h simply has a structure with three components and a list of C-style function declarations. All of the math headers use forward declarations rather than including each other. I just can't figure this out. Why would the compiler think that slVec3 wasn't a type when it's header is included directly above? And why would the problem only show up when I use the library, not when I compile it?   
  Have you considered the possibility that slVec3 is indeed not a type? Is the type definition available in the correct namespace? This kind of error would only crop up when the header files are used (as header files are never compiled, only included).   ;  slVec3 is not in a namespace (well it's in the global one). Perhaps the compiler is looking in the sheeplib::model namespace for it and giving up? Is there something I need to do to make it look in the global namespace?   ;  ::slVec3 would, though it's completely unnecessary (type lookup isn't subject to the same overloading issues as functions).This leaves the possibility that the definition is incorrect (perhaps it's a function or a class template) or absent (perhaps you include the incorrect file).   ;  Hmm, well I everything looks OK to me :(I've uploaded the code  here  (It's listed as Broken Version) perhaps you could take a look and see what I'm doing wrong?It uses CMake if you want to compile it, but its the stuff in the include directory that seems to be the problem. Thanks,Luke.   ;  My first remark is that the #ifdef __CPLUSPLUS seems useless, since the code won't compile in C anyway. This probably isn't your problem though. I'm afraid I won't have a CMake-enabled computer until monday, though, but I can't find any obvious error in there. Are you certain that the correct files are being included? Could you construct a minimal example?;  Yeh, originally the math part was a separate C lib, I was merging it with the model stuff when the problem occurred.... I've just fixed it. I still had an earlier version of the files in /usr/include/SL/math, it must have been including them instead. I removed the folder and now it's including the correct header. *bangs head on table*Thanks for all your help!!Luke.   ;  Hi, Your problem might be:#include "../math/vec2.h"#include "../math/vec4.h"#include "../math/vec3.h"now you said that you have added /include/sheeplib/ to the directory search, try changing the above to:#include "math/vec2.h"#include "math/vec4.h"#include "math/vec3.h"maybe that will help you.   ;Quote:Original post by Kazade... I've just fixed it. I still had an earlier version of the files in /usr/include/SL/math, it must have been including them instead. I removed the folder and now it's including the correct header. *bangs head on table*This is what version control is for.   ;  Version control wouldn't have helped in that situation. I had changed the installation path. The original was in /usr/include, I changed it to /usr/local/include. I guess /usr/include gets preference, I just forgot to remove the original installation. The project itself is in SVN. Oh well, I'm just glad it's fixed [smile]   