I'm trying to build a project of mine that includes fuzzylite C++ libraries within a Carbon C++ application. However the compiler throws out an error for each fuzzylite's library I include in my source code. I've tried to include the Header Search Path and the Library Search Path on my target application build info but it doesn't work.
I've included the header file using double quote markers just like the following example:
#include "fuzzylite/test.h"
How can I include such library in my project and get it to work properly?
Easy, you need clean the path: #include "fuzzylite/test.h" for ALL #include, like this: #include "test.h"
From version 3.1, you should use #include fl/Headers.h.
If you are running into problems, I strongly encourage you to report the problem in the forums at http://www.fuzzylite.com, where I and others will be very happy to help you.
Related
I am trying to use header file (it is wiringPi library for gnio). I am using Eclipse with C++. I tried to add header like this, please advise where I am wrong or what is missing. I have already added path for header files as Properties > C/C++ Build >Settings > Include.
Currently you are using #include <wiring.h> but the correct syntax for C++ when including headers is #include "wiring.h".
I am trying to compile a program that uses rocksdb.
According to the example in the official webpage, the only header i should add to my code is db.h.
Now, the file i am compiling is in folder A.
db.h however is in A/rocksdb-master/include/rocksdb/.
So, i add this line to my file:
#include "rocksdb-master/include/rocksdb"
It finds the file, but the problem is that inside db.h, i have this line:
#include "rocksdb/metadata.h"
And when i compile i get this error:
fatal error: rocksdb/metadata.h: No such file or directory
#include "rocksdb/metadata.h"
I mean, it's obvious. db.h is in the same folder as metadata.h, so it's fine that the compiler cant find any rocksdb folder. But i doubt that people who wrote this library don't know that.
Is there any other way to add the path's to compile it?
Why is it that the path from db.h are not relative to where it is located?
You should normally use just the following header in your project:
#include "rocksdb/db.h"
When compiling your own project, you should then add the RocksDB include path to the list of include directories. For example, if the RocksDB source code is in directory ../rocksdb-master, the include path will be ../rocksdb-master/include.
How to add the include path to the compiler flags is indeed compiler-specific. With g++ or clang, it's done by passing -I../rocksdb-master/include to the compiler when compiling your own program. Note that you many need to link against the RocksDB library as well.
And finally, you may need to include some more RocksDB headers if you use some of its advanced concepts, e.g. transactions.
I've downloaded the latest version of FreeType and want to get the source code running in my program. I'm programming in Eclipse and I've copied all the Freetype files into my project. I've listed them under ProjectName/Source/FreeType2/..
I've added compiler include directories for the new folders, so my GCC C++ compiler knows where to look for them. However, if I build my project, an error occurs on the last line of the following code:
#include <ft2build.h>
#include FT_WINFONTS_H
#include FT_INTERNAL_DEBUG_H
I did some research and the macro file FT_INTERNAL_DEBUG_H is defined as <internal/ftdebug.h>. The file is present in my system and the macro file FT_WINFONTS_H compiles like a charm! I think it's got something to do with my directory stucture somehow. How should I change my directory structure in order to get things compiled succesfully? My current structure is like this:
ProjectName
Source
FreeType2
devel
docs
include
config
internal
objs
src
I know I used two "source" folders, but this shouldn't be the problem, right?
The error message I get is Invalid preprocessor directive: #include FT_INTERNAL_DEBUG_H
Thank you for your time ;)
How can i add the cplex's library into my netbeans 7.4 cpp project?
I've tried to add inserting all the file path :
" #include "/Users/.../Applications/IBM/ILOG/CPLEX_Studio_Preview1251/cplex/include/ilcplex/ilocplex.h""
but I still have error, the compiler said:
There are unresolved includes inside
"/Users/.../Applications/IBM/ILOG/CPLEX_Studio_Preview1251/cplex/include/ilcplex/ilocplex.h""
Thank you
The correct way is to put in your .h/.cxx code
#include "ilcplex/ilocplex.h"
Then in your project setting you add an include path so you get a flag -I pointing to {somewhere}/cplex/include
This will solve the compilation problem.
But you should also set the library by adding the library cplex1251.lib (check name) and the library path {somewhere}/cplex/lib/vs{number}/{variant}
May be you should have a look at the manual
manual, IBM forum
I am working on a C++ project using Xcode on MacOS X, and am now starting to port it to Linux using the Code::Blocks IDE.
Many of my source files are in separate directories and I am having issues including them.
Here is an example of this issue:
folder1/foo.h
folder2/dog.h
foo.h includes dog.h with: `#include "dog.h"`
It works fine on Xcode if both files in the same project but if I try it in Code::Blocks it has an error finding it.
I can fix this issue in Code::Blocks by changing the code to use a relative include path such as:
#include "../folder2/dog.h"
Unfortunately doing this stops Xcode from being able to find the file.
How can I fix this issue so I can compile the same code in multiple IDEs? I would like to avoid throwing all the source in the same folder. Should I use a preprocessor statement similar to:
#if XCODE
#include "dog.h"
#else
#include "../folder2/dog.h"
#endif
Rearrange your structure so that one project has only one common include directory:
/project/
/src/*.cpp
/include/*.hpp
/folder1/dog.hpp
/folder2/cat.hpp
Now say #include <config.hpp> and #include <folder1/dog.hpp> etc., and add to your compiler flags:
-I ${PROJECT_DIR}/include
How a given compiler/IDE locates dependencies is, unfortunately, entirely compiler/IDE-specific. There is no way to arrange this in such a way that it will be honoured by all development environments.
I don't know Xcode or Codeblocks, but I'm sure there must be some project configuration that controls where they looks for #include files.