Why doesn't Xcode6 see included header files - c++

I'm trying to build opencv2 as a universal framework. I am systematically removing the files/folders that I do not need. But I am running into this issue where the include files are not found. See the image below:
The following image clearly shows that the file is indeed there.
One of the contractors working with us said he had put the include files into the same directory as the source files and rename them according to their file structure but using "." instead of "/" as shown below:
But that means that I must go through all of the files that include files and change the include statement to use "." instead of "/". REALLY?
Is this true? Or do we have a configuration set wrong?

You need to setup search paths for your target in Build Settings->Search Paths->Header search paths.

Related

IAR C Preprocessor include directories

I've been asked to make a small mod to some software that was written back in the mid naughties on IAR Embedded Workbench v3.3
I have had the original source files copied from an old machine to one I have been given for the task.
For the moment I am simply trying to get the software compiling. It took me a while to realise, or at least I thought I'd realised, that the reason it couldn't open various header files was that, incredibly, all the include paths were absolute, not relative.
So, I changed all the paths to be $PROJ_DIR$ relative, but then started to get different files that couldn't be opened. Then realised that the machine they gave me just happened to have a very similar directory structure to the original machine used and, amazingly, had quite a few of the same files in the directory structure of this machine I'm using as was on the machine used to compile the code originally.
I then thought, OK, I'll just check I have got my relative paths correct by choosing one of the header files it was complaining about not finding and putting, in the Preprocessor tab, an absolute path to the directory on this machine I'm using that contained the header file it wanted. However, that still wouldn't find the header file!
Finally, I put an absolute path in the c file to point to the desired header file.
#include "C:\absolute__Path\stdtyp.h"
And it compiled.
To confirm:
Putting C:\absolute__Path
in the Project | Options | C/C++ compiler | Preprocessor tab will not work if I just have:
#include "stdtyp.h"
in the c file.
I have used IAR in the past - not that much - but I have used it and I was sure that's where you set your include directories. So, am I wrong, or can there be something else that is overriding that path in the Preprocessor tab as described above?
Edit: I'm not wrong, after having slept on it, I decided to create a new project with random directories, subdirectories and header files. Sure enough, if I set and remove $PROJ_DIR$ referenced paths in the preprocessor tab, the new project compiles, then doesn't. So, there must be something, presumably in the ewp file that is borking it.
It turns out you can override the paths on an individual file by file basis. So, the rogue files had the paths overridden and had absolute paths.
Right click on the file in EW and select Options.
That then for most file shows a load of greyed out boxes. What I'd failed to do was thoroughly check all files. The few I'd randomly checked were greyed out, but some files had their properties overridden here with different (and absolute) paths put there.
At least now the project can be easily copied between machines having used relative paths.

VSCode: How to add include path of project subDirectory?

I just started using VSCode on linux Ubuntu environment and for past one day trying to include some header files from a sub-Directory (the project screen shot is shown below).
I have tired adding the header file path in include path but showing error.(Image below)
I also tired by provided complete path e.g. /home/user/Work/Cpp_Test_Project/OpenFace/FaceAnalyser/include/ still it couldn't find the header file.
Also, If I try to include the header with local path e.g.
#include <OpenFace/LandmarkDetector/LandmarkCoreIncludes.h
then all the internally linked header file doesn't work.
any help will be highly appreciated.
The c_cpp_properties.json file is for configuring IntelliSense. The compiler you are using does not read from this file, so you will need to configure the include path for that separately. From what you have posted, it is unclear how you have set up your build.

How to add entire path into IAR

I just start to use IAR Embedded workbench and meet an issue now. What I need to do is to make a project via IAR with some specific file(.h and .c).
In Eclipse I can add a directory, and then when it compiles, it will scan every sub-directories in the directory to find the included files. I did the same in IAR, but it didn't work. The IAR only scans the directory I added in the 'preprocess' TAG, and it never scans the sub folders in it. Is there any way that can help me to let the IAR scan the 'entire directory', not only the current path?
I'm not sure if my description is accurate or not. Please let me know and help me with this issue.
Thank you so much!!!!!
Your description of the IAR C and C++ include file search is correct: you must explicitly include the directory. The compiler does not search subdirectories.
If the number of subdirectories makes entry in the [IDE Options> Preprocessor > Additional include directories] entry table unwieldy, you can place them in a separate text file and add "-f " in the extra options. Note that using that parameter you may want to use the $PROJ_DIR$ as a root for a relative path.
$PROJ_DIR$ does not seem to get expanded if you put the include directories in a file and use -f

Eclipse c++ project folders

I have a lot of classes in my project which means a lot of files too. I want to put everything in subfolders so it's a grouped together and a bit more clear.
There is already a folder names scr where all my cpp and header files are in but I want to create a folder named 'products' and put all the product-related files in there.
But when I do so, I get this error (after pressing build) that one of my classes can't be build. It says:
make: * [scr/Producten/AudioKaart.o] Error 1 KassaSysteem C/C++
Problem recipe for target `scr/Producten/AudioKaart.o'
failed subdir.mk /KassaSysteem/Debug/scr/Producten line 30 C/C++
Problem
What's the right way to put files in subfolders? Do I need to change the includes? Or do something more than just dragging and dropping them into the folder?
If you put headers in your Producten directory, you need to include this directory in your project settings. Another way is to include your header by specifying the sub-directory, something like
#include "Producten/xxx.h"
Eclipse uses directories for project folders, so you need to adjust all includes as well.

Eclipse C++ including header file from my source folder

I'm pretty new to C++ and Eclipse in general so I apologise if I'm missing something fairly obvious.
The problem I'm having is that I'm trying to include a header file in one of my source files but they're in different folders in my project directory. I have no idea how I should be including them. I've uploaded an image showing my problem with the header file I want to include highlighted.
If someone could tell me what '#include' statement I should be using them that would be brilliant.
Thanks!
There are a couple of different options to make this work. Simplest is to change the #include to
#include "../Statistics/Statistics.h"
This will work without any other modifications. However, if you move either file, or somehow change the relative path between the two, this will break.
Alternately, you can add the path to the Statistics folder to your compiler's include file search path. Right click on the project name, select Properties -> C/C++ Build -> Settings and then find the includes files path option for your compiler. For g++, it is -I<path/to/include/folder>. Adding this will make the #include statement work as you currently have it.
A very similar option to the second one is to add the path to the src folder (instead of the Statistics folder) to the includes search path. In this case, you'll have to change the statement to
#include "Statistics/Statistics.h"
When you create subfolders in your src folder then each cpp file is compiled in that folder it is located in. Thus, any "" includes need to specify the relative path to get from that folder to another.
In your case, to get from inside the FileInOut folder you need to go back one level and then into the Statistics folder
eg
#include "../Statistics/Statistics.h"
Another alternative is, if you are keeping your includes in your src directory, to add the src directory to the include path. Now when you include you need only specify the path from the src root.
eg.
#include "Statistics/Statistics.h"