Header files not found - unit-testing

I'm adding unit tests (SenTest) to my existing XCode 4.2 project. XCode is complaining that it can't find the required Box2D header files. For instance,
Box2D/Dynamics/b2Fixture.h file not found
The Box2D source files are added to my project under the "libs" group. The header files are found without a problem when building the non-test target. Obviously, I can't add the header files to the test target, but I've added all of Box2D's .cpp files to that target. That just resulted in more of the "Lexical or Preprocessor Issue"s, as above.
How do I tell XCode where to find these header files?

I don't believe you need to specify the folder when referencing a .h file. If only the .h file is added to the project in any group or subgroup XCode is able to find the path when you reference the .h file by the name only.

Related

How to connect single.c/.h files to cmake project?

So, I'm new to cmake and have some troubles. I have simple cmake project that contains a few .h and .c files. I've searched C code at github which consists of only one .h and one .c files. And i want to use some functions from this pack, but i don't want to put this file in my project directory. I want to keep them somewhere outside the project directory. So, how to connect them to project, how to make header visible for project and use #include "name.h" for watching and
and using available C functions .c/.h pack in my project.
Create some other directory in your project, such as misc/ and put the files there. Then use it in your code via "/misc/name.h"

add_executable (or adding source to project) vs including it?

I have been curious about the difference between including a file in another source file with #include filename.h and "adding" a source to a C++ project.
In Visual Studio, adding a source file to a project is done by right clicking and choosing "add existing source to project".
We don't need to do that to a file that is in the "additional directories" path and included using #include.
However, sometimes .cpp files which are not #included need to be added to the project.
So:
When is it that a .cpp file needs to be added to my project?
Also, W/R/T to CMAKE:
When I specify include_directories and point it to the path where I my files to be included are, and those files are referenced in the source, why do I also have to add every header with add_exectuable?
In other words, those files are included with #include and CMAKE knows where to look for them, so what does setting add_executable do?

How to link a folder with some .cpp and .h files in a another directory as a Include path to Unreal Engine Project?

I have a UE4 project , And there is about 10 .cpp and .h files in another directory. I just want to add that directory as an Include path.
We can have script files in Source folder ,but let's say I have a folder with 10 .cpp and header files in D:\MyScripts and my unreal project is in D:\MyProj , I want to unreal to search for source files within that D:\Myscripts folder. when I compile the project, There should be a way to specify include paths.
Is this possible ? if possible how can i do ?
I searched internet nearly for two days, but I couldn't find anything helpful.
Hop someone can help me on this :)
Yes, it is possible. You can create make file and add all the .cpp file and .o file.Reference link here.

Eclipse CDT: How to make separate header folder?

I was trying to separate my header files (.h) from my (.cpp) implementation by storing them in two different source folders. However, Eclipse then tells the compiler to look for the .h file in the same folder as the .cpp file. This causes the compiler to stop as it can't find the specified file. Is there any way to create such folders in Eclipse and get around this issue?
In visual studio there is separate folder for header files so can we make a separate folder for header files in Eclipse CDT too?

XCode does not add c++ source files that are in subdirectories into Compile Sources

I use XCode 5.1 for C++ development. I have existing code which I add to the project by dragging files from Finder. The project shows all necessary .h and .cpp files. But when I click Build Phases->Compile Sources, I only see sources that from the root directory in my source structure. None of the source files from subdirectories appear in the Compile Sources. Why? And how to fix this?
Also, when I try to add the missing .cpp file from Build Phases->Compile Sources by pressing +, XCode does not expand the subdirectories, so I cannot select the missing .cpp files.
This is unbelievable. The only problem was that I was adding folder structure with Create folder references for any added folders option instead of Create groups for any added folders.
But still don't understand what is the difference in terms of recognition of source files.
Other peculiarity is that you should add resource files in opposite way (Create folder references for any added folders). Otherwise the iOS application does not find the files and does not compile.