Including TensorFlow into JUCE project - c++

I am trying to include the TensorFlow C Library in my JUCE project. Until now, with no luck.
When following the TensorFlow guide on how to install the library for C I get lost after the extraction part (developing with Windows). I Add the files inside the include folder to my project using the Projucer. The library with the dll and lib file is added as well. When running Visual Studio, however, there are some includes not inside the provided include folder. My guess is, that I need to link the included library with the full TensorFlow blackened.
Did anyone manage to include TensorFlow inside a JUCE project?
Tutorials I've looked at already:
https://www.tensorflow.org/install/lang_c
https://forum.juce.com/t/has-anyone-managed-to-integrate-tensorflow-api-in-a-juce-project/28019
How to use the tensorflow 2.0 C API?

Related

Autocompletion not working for external C++ library in VSode

I'm using VScode on a Linux workstation and I have some problems with Intellisense. In particular, I have a C++ library installed in my home directory. Then, on my desktop folder, I have a C++ project that is including headers from that library.
I created a folder .vscode with the file c_cpp_properties.json (adapted from here). Now, if I right-click an a type coming from that library, VScode successfully goes to definitions and declarations into the headers of the library. The only thing that is not working is the autocompletion. I tried with ctrl-space, and every time I get No suggestions.

Link C++ Library in Xcode [Mac]

First of all, I am completely new to C++. What I have:
Mac
Installed Xcode
Thats it. No prior knowledge about anything Xcode/C++ related.
I need to use a few functions from GSL library, to run a code for my project. What I did:
From GSL library site I downloaded a file called "gsl-latest.tar.gz".
Moved it to my C++ folder on desktop and unpacked it.(attached screenshoot of unpacked folder and what it includes)
Created an Xcode project by: Xcode -> create a new project -> command line.
Opened a file for this project which contains functions from mentioned library.
I know that in order to use functions I have to include them, i.e:
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_sf_gamma.h>
But before "including" functions, I need to link gsl library to my project. How to do it?
Help.

Linking libjpeg to an xCode project for iOS dev

Good evening,
I have been working on a C++ project from someone of my University which I had to improve for my Bachelor thesis. It basically uses the library libjpeg to do some computation resulting in a steganographic process in order to embed a message into a given image.
Now that the C++ code works smoothly, I'd like to create a little iOS app allowing the user to encrypt whatever message he'd like into an image of his choice. So I created an xCode project following this procedure: using c++ in an iOS app
I also found the following file: libjpeg for iOS which allowed me to compile libjpeg for iOS. Since I'm not so sure how to use the framework freshly created and couldn't find anything sufficiently convincing on the internet, I put all the files (.c and .h) of the libjpeg library into my "include" folder where I have my own .hpp.
xCode only throws me the following error:
xCode error
From what I could gather on several posts, I have to modify the build options of my xCode project to link manually the library, so I tried the following:
Other linking flags
Library search path
This wasn't enough to do the trick and I'm still struggling with the same error xCode throws at me. Any help would be very appreciated on how to proceed!
Thanks a lot,
Theo.
Do not add the .c files to your project, add the libjpeg.a file produced by your build to your project. Add the .h files as you are already doing, or edit the project settings to include their containing folder in the search path.
HTH

How to use C++ libraries?

I am a Python developer and I have not used C++ since university. I am doing scientific programming with python, mainly. I wanted to try C++ to see if it is better performance-wise.
I am quite new in C++. I have found dlib library, which seemed a good library as it had many interesting features. But when I downloaded it, I found several folder full of .h and .cpp files.
In Python, I would have installed a wanted library using pip or something, then use it in my project using import.
Is there a similar installation for c++ libraries? Or do I have to look among all those .h and .cpp files and decide which ones I need in my project then copy them? Or how do I use the dlib library?
I have searched a lot on google but I could not find any indication on how to use a c++ library or install a new package to be used.
I use Visual Studio Community 2017 and Windows 10 if that matters.
To integrate a library, you need two kinds of things:
header files (usually *.h) with the declarations required to let the compiler know about the features in the library (a little similar to an import statement);
compiled library files (usually *.lib) containing the precompiled executable code itself, to let the linker assemble the final executable file.
In some cases (especially for templated code), a library can be made of header files only. In other cases, the package doesn't contain a ready-made library file and you have to build it yourself or manually include the source files (*.c/cpp) in your project.
Not speaking of the innumerable optional settings that you may have to adjust to comply with the specifics of the generated code, such as function calling convention, struct alignment...
Last but not least, some libraries are connected to at run-time only. They are called Dynamic Link Libraries and involve yet different procedures.
All of this is relatively complex and close to black magic for beginners. If you are very lucky, you will find some library documentation telling you which options to use for your compiler. If you can, start from an existing sample project that works!
For dlib, check http://dlib.net/compile.html.
Be ready for a cultural shock when you will compare to the ease of use of the Python modules.
It is quite a broad question, but I'll do my best.
First of all, in C++ libraries consist of header files and precompiled part (.lib,.dll on Windows, .a, .so on Linux). To use them in your project you have to inform your program (and compiler) about features that library has (by #including their header file) and linker to include that library binaries.
pip is package manager, which automatically downloads, builds and installs library that you want in your system. In C++ there is no such single tool at the moment and there steps must be done more or less manually.
For dowloading you usually end up with git or downloading the zip archive with source (do it here). Once you have sources you have to build it.
In order to achieve multiplatformity libraries usually does not get shipped with concrete build system description (Visual Studio Project on Windows or makefile on Linux etc.), but are created in more general tool CMake, which abstracts them. E.g. dlib does that. With use of CMake (For start I recommend CMake-GUI, which is installed with CMake on Windows) you can generate Visual Studio Project, which later you can open and compile to generate .lib file. How exactly to do it follow dlib compilation description.
Once you have you lib and headers files on your disk you can add headers and .lib to your Visual Project and use as any other C++ library. (Seems old, but should work)
As far as I know, there are no tools similar to pip for C++. What you have to do depends on your working environment and the respective library.
In case of dlib there are instructions on the project homepage for Visual Studio. Basically, it involves compiling the whole library alongside your own project by copying a single source file to it and setting up include pathes.
From http://dlib.net/compile.html:
Compiling on Windows Using Visual Studio 2015 or Newer
All you need to do is create an empty console project. Then add dlib/all/source.cpp to it and add the folder containing the dlib folder to the #include search path. Then you can compile any example program by adding it to your project.
Again, note that dlib will only be able to work with jpeg and png files if you link in libjpeg and libpng. In Visual Studio, the easiest way to do this is to add all the libjpeg, libpng, and zlib source files in the dlib/external folder into your project and also define the DLIB_PNG_SUPPORT and DLIB_JPEG_SUPPORT preprocessor directives. If you don't know how to configure Visual Studio then you should use CMake as shown above since it will take care of everything automatically.
You have to download them, put them in your project directory, and then include them almost the same way you would do in python. You need to include only the .h files.
Example for test.h:
#include "test.h"
Hope this helps!

iostream file not found in xcode 5

I am using ZXing library with version 2.2 for QRCode scan on xcode version 5.0.2
One of the file named "Counted.h" contains #include .
All the libraries are added and header path is also set as mentioned in different questions.
I have a ZXing integrated stand alone project which is compiling successfully but facing errors when trying to integrate with my project.
It is showing an error "'iostream' file not found" on building the project.
I am also using Tesseract and SQLCipher libraries.
Probably there is some issue in build settings.
Can anyone tell me if I am missing out anything??