waqmaz93
waqmaz93

Reputation: 3

How to add a header file in Visual Studio 2013, C++

I use Visual Studio 2013 to build a program. I have got some problems... a) an error:

c:\users\wojciech\desktop\cryingdamson 0.3.6 (8.60) v8.2 source\otpch.h(28): fatal error C1083: Cannot open include file: 'libxml/xmlmemory.h': No such file or directory

My code:

#include <libxml/xmlmemory.h>

I have included that file in Visual Studio 2013 to header files and I have even it at libxml folder. I can not still build solution (compile) because of that error.

Please help me, I am new to Visual Studio. I have tried to add xmlmemory.h file to project properties, but it seems that it doesn't see the file.

Okay, in folder "c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3" there is a file named MainProject.sln, which type is microsoft visual solution. In the same folder I have added libxml folder and in the folder I have put xmlmemory.h. The problem is I still can not compile the program.

I use windows 7.

Upvotes: 0

Views: 1581

Answers (2)

Shindou
Shindou

Reputation: 506

Where is your xmlmemory.h? Of #include <.../libxml/xmlmemory.h> try a complete path in the ... part.

The path libxml/xmlmemory.h is in fact ./libxml/xmlmemory.h where ./ means the location of your workspace.

===============Next is added according to your comment==========================

Just using #include "..\libxml\xmlmemory.h" would compile. So your workspace path is therefore c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3. Under your workspace there should be a folder MainProject where your existed source files are located. So .\ means the path c:\users\wojciech\my documents\visual studio 2013\projects\consoleapplication3\MainProject.

Note that you should use \ other than / to represent your file hierarchy in your project and that you should use "xxx.h" other than <xxx.h>.

You can also use this method: open VIEW->Property Manager, right click on MainProject and open Properties, in C/C++ -> General -> Additional Include Directories, add your folder libxml to it. Then all files under your libxml folder would become a part of your solution. You can just use #include "xmlmemory.h>" to make it compile.

Either way is supposed to compile.

Upvotes: 0

Thomas Sparber
Thomas Sparber

Reputation: 2917

You Need to add the parent Folder of libxml to the include path. Say if the Folder structure Looks like

  • some_project
    • include
      • libxml
        • xmlmemory.h
  • ...

you Need to add the include Directory to the include path

Upvotes: 0

Related Questions