I'm trying to package a toolkit for C++ where the include files are spread over several folders, like so:
Includes - cen_dcm -dcmnet
-ofstd
-dcmdata
Inside the nuspec is: include: { ${SDK_Base}\cen_dcm\**\*.h };
With this package deployed I get the include files in the following location:
..\packages\DCMTK.3.42.0.0\build\native\include including subfolders.
When I use the including the IntelliSense has no problems finding it, but if that include file includes something from a different folder it fails to find it.
So I use: #include"dcmnet/assoc.h" which works just fine, but when compiling assoc.h it reports it cannot find osconfig.h
That file is in the package but in the ofstd folder.
Normally I'd solve that by adding additional includes, but since this is a package I don't want that.
What am I missing? I can't imagine that support for something so basic is lacking?
To answer my own question. You can add {targets} to your autopkg file.
It looks like this:
targets {
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm";
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm\config";
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm\dcmtls";
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm\dcmdata";
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm\dcmnet";
Includes += "$(MSBuildThisFileDirectory)..\..${d_include}cen_dcm\ofstd";
}
This additional include folders will show up in the of your package.targets file.
There are more possibilities using {targets}. See http://coapp.org/reference/autopackage-ref.html
Related
So I've been making a Java project using Gradle (GitHub), but it uses/needs JNI (natives).
I was first using Makefiles to compile and link the C++ code, but then I found out how to compile and link C++ natives using Gradle, so I got all of that working. But now I am stuck, because I can't find a way to include all natives, on the same level (base) inside of the JAR file. NOTE: I don't need help with compiling the natives, only with including/packaging them.
EDIT: I just commited the changes to GitHub.
This is my directory structure:
[Project Directory]
- build.gradle
- src/
- win32/ (the only native library that i currently have)
- cpp/
- main/
- java/
- build/
- libs/ (here is the JAR and the natives)
- win32/ (the natives)
- shared/ (the dynamic link libraries, i only want these)
- x64/ (i want to include both x64 and x86)
- mylibrary.dll (just the DLLs should be included)
- mylibrary.ext
- mylibrary.lib
- x86/
So there are a few criteria:
I only want the DLL files, none of the .ext and .lib stuff.
I want to be able to dynamically change the amount of libraries and the names of the natives.
What I have tried:
My first attempt was just looping through all folders. I didn't have to use recursion because the depth of the file structure is fixed, so it will never be further from or closer to the build/libs directory. This is how I tried coding it:
sourceSets {
main {
resources {
srcDirs "src/main/resources"
// include natives
String libfp = "${buildDir}/libs/"
File libf = new File(libfp);
if (!libf.exists())
libf.mkdir();
FileFilter isDir = f -> f.isDirectory();
FileFilter isDll = f -> f.getAbsolutePath().endsWith(".dll");
for (File file : libf.listFiles(isDir)) { // iterate "libs" to find all libraries
// enter "shared"
File filen = new File(file.getAbsolutePath() + "/shared/");
for (File file1 : filen.listFiles(isDir)) { // iterate over "shared" to find all platforms
for (File file2 : file1.listFiles(isDll)) { // get all dlls
include(file2.getAbsolutePath())
}
}
}
}
}
}
This worked, except from the including itself. I don't know if I understand how this works correctly, but the include function didn't seem to add anything to the resources.
Then, I checked the documentation and found it was a pattern based function, so I tried making a simple include call with the pattern I thought would work:
include "/build/libs/**/*.dll"
// I also tried the following:
include "/build/libs/**.dll"
include "/build/libs/*.dll"
But that didn't seem to work too. So I think I am just misunderstanding how the include function works.
Just use
include '/build/libs/**'
will work. Thanks.
I'm working with a C++ Unreal Engine project and made my own custom module called MyActor, Unreal Engine automatically created the .cpp and .h files for me. That much appears to be working.
So now I want to include classes or methods from the AppleARKit plugin then override and call them from my custom MyActor module.
First I tried using #include AppleARKitLiveLinkSourceFactory.h because it has theIARKitBlendShapePublisher::PublishBlendshapes method which I want to modify and use.
It didn't work at first with this error: E1696 Cannot open source file AppleARKitLiveLinkSourceFactory.h but I found out I could include them in Visual Studio using the "Include Directories" under Properties like this:
The AppleARKitLiveLinkSourceFactory.h lives in the Public folder but I included the Private folder as well, I don't know if I need to do that. This appeared to work at first but then I got the same error as before for every dependency inside the AppleARKitLiveLinkSourceFactory.h file.
Do I have to include the individual directories for every dependency down the entire chain? Is there an easier way?
When I ran into the issue of including files from a plugin, in my case LidarPointCloud, the following steps worked for me:
1) In my <project-name>.Build.cs file, I added the module name I wished to use (LidarPointCloudRuntime) to the public dependency list
PublicDependencyModuleNames.AddRange(new string[] { "LidarPointCloudRuntime", "Core", "CoreUObject", "Engine", "InputCore" });
I determined the module name by opening the .uplugin file in the plugin's folder, and looked at the Modules section. If multiple module names are listed, you should pick the one that contains the source for the classes you care about.
2) I then rebuilt the project, closed my editor, then right clicked my <project-name>.uproject file and regenerated project files.
After that, I was able to access the .h files in my code.
-Update-
It seems that AppleARKitFaceSupport has dependencies on other plugins that may need to be included. For example, ARSystems.h lives in AugmentedReality. When I add that to PublicDependencyModuleNames and perform the same steps, it can find ARSystem.h.
I am trying to use nlohmann json in my C++ project. I extracted the zipped file after I downloaded it from github. I renamed the extracted folder to be nlohmann_json and just copied it inside my project .
The github doc says :
json.hpp is the single required file in single_include/nlohmann or released here. You need to add
#include <nlohmann/json.hpp>
// for convenience
using json = nlohmann::json;
So in my .cpp file, I have the following lines :
#include "nlohmann_json/include/nlohmann/json.hpp"
using json = nlohmann::json;
But Visual Studio 2015 IDE shows as tooltip the following message:
namespace nlohmann has no member json
After typing just nlohmann:: , I get an auto suggestion of json_pointer but not json.
What is going wrong actually ?
You actually have a hint to your problem.
json.hpp is the single required file in single_include/nlohmann or released here. You need to add
If you go to the original tree you checked out from github, and do this:
$ find . -name json.hpp
./include/nlohmann/json.hpp
./single_include/nlohmann/json.hpp
You might see your problem. You're including the first of the found files. You really need the second one -OR- you need to set up includes search path better.
Here's what I would do. I would copy ./single_include/nlohmann/json.hpp into the project. I would NOT include the entire tree, just that file. And include it.
I think that will work better for you.
You can either use the single header approach where you can directly include the single json.hpp (inside the single_include, just drop nlohmann/json.hpp at the root of your project). Or if you want to include the one that have multiple files then you will need to set additional include headers in your VS project settings.
MyProj
nlohmann\....
main.cpp
Then in your VS project settings add the path to your project to the additional include directories.
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.
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.