简体   繁体   中英

VS2010 Additional Include Directories failing to work

I've recently begun a fairly small 2D project using SFML and TinyXML and have had these working fine until recently. I've organised my folder structures in a personal yet mobile state so that I can copy it across to another computer and resume without any extra set-up.

However, whenever compiling I'm receiving issues including files.

spaaace\\source\\xmlparser.h(4): fatal error C1083: Cannot open include file: 'TinyXML\\tinyxml.h': No such file or directory

So I figured I must have forgotten to update the 'additional include directories' (which by the way, there is only one), but no, still the same issue.

This seems like such a simple little issue and I'm sure I'll slap myself in the face once I find the cause. I've spent over half an hour trying to fix it, Google it, and so forth.

To clarify, my project structure is somewhat like this:

base\\include\\SFML

base\\include\\TinyXML

base\\project\\debug

base\\project\\release

base\\project\\project\\source\\

With all my actual source files in the last one. I've selected the include folder at least half a dozen times now via 'C/C++ > General > Additional Include Directories' with no change.

I've tried including the folder about 20 different ways and the only one that seems to work is using a complete path (eg C:\\users\\admin\\desktop\\project\\include) which seems impractical. I also find it impractical having to dump the entire include directory into my project which defeats the purpose of it in the first place.

I've tried: >

include "tinyxml.h"

include "TinyXML/tinyxml.h"

include "include/TinyXML/tinyxml.h"

include "../TinyXML/tinyxml.h"

include "../../TinyXML/tinyxml.h"

include "../include/TinyXML/tinyxml.h"

include "../include/TinyXML/tinyxml.h"

and so forth, as well as using <>s instead of ""s.

Just one more note, it's not just TinyXML that's having this issue, SFML too; it's not file specific.

The additional directory paths are relative to the your project file's (.vcxproj) location. So, given that your project file is located in base/project directory, you may specify one additional dir:

..\\include

And then go with including:

#include <TinyXML/tinyxml.h>

Angle brackets are used to direct the compiler to start the search from the search locations, not from the directory, where the header/cpp with this directive is located.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM