YAKOVM
YAKOVM

Reputation: 10153

Visual studio - how to include correctly

The question is about existing project which is compiled and executed successfully - I try to add to it some functionality

In the project in path C:\TestProject\components\VolumeUtilities\Include\Ilistener.h I have following code :

#include <vector>
#include "VolumeUtilitiesDefs.h"
#include "..\Map3D\IProvider.h"
#include "PolygonsAlgorithms.h"



namespace volumeutilities
{
    class IListener
    {
       //code
    };
}

I want anther (existing) class to inherit from IListener. This class is path is C:\TestProject\components\Sound\SoundManager\SoundManager.h And in properties ->general -> additonal include ../.. So I added

#include "VolumeUtilities/Include/IListener.h"

looks that this part is ok, but in Ilistener.h new problem appeared - it can`t include

#include "..\Map3D\IProvider.h" (no such path or directory)

I think that compiler searches for IProvider.h in C:\TestProject\components\Sound\Map3D
instead of C:\TestProject\components\VolumeUtilities\Include
How the issue could be solved?

Upvotes: 1

Views: 56

Answers (1)

Barrnet Chou
Barrnet Chou

Reputation: 1933

According to your description, IProvider.h and IListener.h are in the same folder C:\TestProject\components\VolumeUtilities\Include. If so, you could add C:\TestProject\components\VolumeUtilities\Include rather than #include "VolumeUtilities/Include/IListener.h" in properties ->general -> Additonal Include Directories. I suggest that you could click the button.

enter image description here

Upvotes: 1

Related Questions