2

I have a c++ application which I want to use some external code in it. The external code is placed in a relative path "........\External" folder. The external code has a cpp file aaa.cpp which include bbb.h header file.

I also have my own - changed - bbb.h file in my solution but I want that the aaa.cpp file will include MY bbb file and not thr bbb file in the external folder. It means that the aaa.cpp file is in my solution but is taken from "......\External" and the bbb.h file is also in my solution but without a relative path.

I tried to compile it and the aaa.cpp file has an error on this line:

#include "bbb.h"

Error: cannot open source file bbb.h

How can I solve this issue?

5
  • Do you have the source code for aaa.cpp? Commented Dec 16, 2013 at 17:39
  • Your path to bbb.h must be wrong Commented Dec 16, 2013 at 17:41
  • it doesn't havea any path, bbb file has no relative path, it is in my solution, I don't want the externak bbb.h file Commented Dec 16, 2013 at 17:42
  • You need to give us more details on your build environment. As you keep mentioning the word "Solution", one could guess that you were using Microsoft Visual Studio. Commented Dec 16, 2013 at 17:51
  • yes, visual studio 2010 Commented Dec 16, 2013 at 18:03

1 Answer 1

1

Even if you have added the file to the solution, if it is in a different folder on your computer then Visual studio can't find it to compile.

Make sure that the file is in the same folder as all your other source files. If it is not, either move it there or right click on the project and go C/C++ -> Additional include directories and add the folder containing the files you want to include.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.