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

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.

Related

How to make Visual Studio automatically detect a .cpp file in a subfolder?

As it's described in the title, I would like to make Visual Studio detect a .cpp file which is in a subfolder. (It's a C++ project.)
My program automatically creates new .cpp files and .h files, but when it creates a new .cpp, it doesn't detect the .cpp file in the subfolder of the project. Even if I restart the project/program.
What could I do to make it automatic?
Does an instruction exist to tell Visual Studio/or the program to compile this .cpp file ?
Does every .cpp file have to be in the same folder? I could do it that way, but it would be more organized if the different files are in different folders.
So I didn't find any solutions, but I've ask severals persons, and they told me that I might have to change by hand some files automactly created by Visual studio to tell them to include a specific .cpp file. But to identify which file I've to change and if I can open them as a txt file ect.. It was too much work, then I've decided to change my project.
Thanks for your help ! And I hope this will give you a little taste of what you have to do if you have the same problem

cannot open the header file in C++

I'm doing my assignment that need to using the #include function
but I found that after I define the header file, I cannot open the header file in the main.cpp
and I also didn't find any xxx.h file in the project file
here is the situation
The reason of search.h can open is I found that in external dependencies file, there is a search.h, but the search.h I want to open is not the search.h in external dependencies file
You don't have header files in your project. Create the header files xxx.h in the project directory. So the compiler will be able to locate them.
If the person who gave you the project has provided you the header files along with the project requirements then, just copy and paste the xxx.h files into the project directory. This would solve your problem.
To learn more about the header file. Click on the below tutorial link
Header Files
How to add header files in Visual Studio 2010 - Youtube
It looks like you don't have any header files included in your project. Visual Studio is attempting to find the header files in the header directory of your project but it cannot find any. Save your header files into separate files and add them to your header directory in the project. Then you should not have any problem.

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.

Unable to include header file in C++ console application project

I have been trying linking of a .lib file and also including a header file in my C++ console application project. I copied the C++ header file from one of my other projects, and pasted it under Header Files folder in console application project. Here's the screenshot to see: http://i.imgur.com/JFFIn.png
However, when I try to include the header in my code as #include..., I do not get an intellisense with my header file's name. (I only see targetver.h, stdafx.h and Debug folder)
I tried to point Add additional include directories in my C++ console application project properties to the Project folder itself, but that doesn't seem to help and the file still doesn't show up.
If I write the name of the header file as #include "DllTest.h", I get an error saying: Cannot open include file: 'DLLTest.h': No such file or directory c:\users\ht\documents\visual studio 2010\projects\dlltest\dlltestconsole\dlltestconsole.cpp
How is the header file included in here, so that it starts appearing? If I add a new item > Header File, name it to DLLTest.h and copy paste the header files content here, it just shows up normally. How will the header file which is copied - pasted into Header Files folder show up in the code?
In C++ projects, the things that look like folders in the Solution Explorer aren't actually folders, they are filters. They are UI-only entities that can be used to organize project items in the IDE. They do not in any way reflect the structure or location of items on disk, though. You can add a file from any location on disk to any filter in the solution.
The compiler knows nothing of these filters; it only knows about files as they exist on disk.
In your case, the files are not located in your project folder. You'll either need to:
copy your files into your project folder, then add them to the project from there (right-click on the solution then Add Existing Item), or
add the files from where they are, then add their location to the "Additional Include Directories" property in the project properties.
I do not know of any way to have the IDE automatically move files to the project directory when you copy and paste them into the project. The C++ project system is fundamentally different from the project system used for C# and VB.

Header files not found

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.