views:

54

answers:

2

I have a two projects, AI and Core, which used to hold a circular dependency. I have a CoreUtilities file that I have broken up to remove this dependency, and added the functions I have removed to a new file called AIUtilities(.cpp/.h).

I then went to the piece in my AI project that uses these functions and added #include "AI/AIUtilities.h" and changed the function call from CoreUtilities::Functionname to AIUtilities::Functionname. Upon compile, I recieved the error given in the title.

Why! How can I fix it?

+1  A: 

Did you update your project settings with the path to the direcory containing AI/AIUtilities?

Update:

  1. From the solution explorer window, right click on your project and choose "properties" then a new windows "your_project_name property page" will pop up.
  2. In this window on the left pane you'll see a tree. Click on 'Configuration properties' which expands to multiple choices. Continue clicking on 'C/C++' then on General. On the right pane appears multiple properties that affect your project.
  3. Choose the "Additional include directories" property and add the path to your new directory. For instance if your path is : "C:\AI\AIUtilities.h" add the following: "C:\" in the property.
  4. Click on "Aplpy button". Done.

As mentioned in other post, you must consider that moving your project around will break your project settings. Don't forget to update them. Or use either environnement variable to set the root of your project or use the "../../" trick. But personnaly I prefer the former.

yves Baumes
I'm not sure. I'm new to C++ environments. How would I go abotu this?
Mark
I've updated my post answering your comment
yves Baumes
I had no idea that the files didn't add to the correct folder. Thanks!
Mark
+1  A: 

You need to ensure that the parent directory of AI is on your header include path. Assuming that your code is laid out like this:

blah/source/  
     AI/  
        AIUtilities.h  
        AIUtilities.cpp 
     Core/
        CoreUtilities.h
        CoreUtilities.cpp

So either you need to have the header search path to '/blah/Source' or '..' depending on how your directories are structured.

Note that if you have sub-directories inside each project then this can cause problems with resolving the header search path. In that case set the header search path to $(ProjectDir)\.. .

the_mandrill
It is at the root level of this project. Regardless, I included the parent. #include "AI/AIUtilities.h"
Mark
I'd suggest running [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) and filtering for `AIUtilities.h` to see which paths are actually being searched.
the_mandrill