link header in Eclipse C++ - c++

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".

Related

How to make header files can be include via Library name?

I'm trying to make a cross-platforms crypto library in C++ at https://github.com/haithngn/cryptor something like https://github.com/MailCore/mailcore2
The Structure is:
Can I make any header files can be include in the statements like this:
#include <Cryptor/MD5Encryptor.h>
I can include these header directly from absolutely file path
../core/CryptorCore.h
But these format will make the source code cannot build succeed in an XCode Project.
I tried to simulate the MailCore2 but that's very difficult.
Hope you can suggest me any solution or do a favor PR on my Repository.
Thanks,
You need to have a proper hierarchy. First, no, you can't have
#include <Cryptor/MD5Encryptor.h>
with your current setup, not while building the library, and not without flattening the hierarchy when installing your files (which CMake can do).
What you can do is:
#include <Cryptor/core/abstract/MD5Encryptor.h>
if you add your project inside a Cryptor folder instead of being at the root of your project.
I would advise you to create a Cryptor.cmake file that would allow people to pick up your library once installed, so that they don't have to know where the library includes are or what the libraries name is.
It should not be necessary to point to every single header file. Just add all directories containing these header files with include_directories(PATH_TO_HEADERS).
For the include of the header file src/core/CryptorCore.h with
#include "CryptorCore.h"
you have to point to
include_directories(${PROJECT_DIR}/core/)

Cannot include header from boost library

I have a problem using - including boost library.
#include <boost/dynamic_bitset.hpp>
And I'm getting error: boost/dynamic_bitset.hpp: No such file or directory
I have a boost folder inside where my project is... How to fix it ? Thanks
If you have the boost folder inside your project, you may just need to tell the compiler to look into that folder for header files.
With gcc/g++ this can be done with the -I</path/to/headers> option (without angular parentheses).
Other compilers work the same way with possibly different flags than -I.

Xcode Error - No such file or directory

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.

Cannot open include file "sqlapi.h" in C++?

I am trying to connect c++ with SQLBase. After building my project I get an error as
" Cannot open include file: 'SQLAPI.h': No such file or directory ".
#include <stdio.h>
#include <SQLAPI.h> // main SQLAPI++ header
#include <sbAPI.h>
Can someone please tell me why am I getting this error and how to fix it?
The file "SQLAPI.h" is not in the include path. You need to add the path to the header files to the compilation flags.
If you are using GCC then add a flag -I like this:
g++ -I/path/to/headers <rest of arguments>
See http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html for the -I option.
If using a Makefile, change CFLAGS or CXXFLAGS to add the -I option.
If using Visual Studio, go into the project properties dialog, select "Configuration Properties" and "VC++ Directories", and modify the "Include Directories" property. (Based on Visual C++ 2010 Express, should be similar in older versions.)
For VS 2008 C++ you need to set the following Project options:
[Project options dialog]
C\C++
Additional Include Directories = C:\Dev\Tools\Win32\SQLApi\3.8.2\include
Linker
General
Additional Library Directories - C:\Dev\Tools\Win32\SQLApi\3.8.2\lib
Input
Additional Dependencies - sqlapis.lib
Warning: example path provided!
Instead of 'C:\Dev\Tools...' set your actual SQLAPI++ library instance location!
I am learning C in Microsoft Visual C++ Express platform.
A way may work:
You should copy your own header files(like SQLAPI.h) to your solution file.
Obviously, it is a complicated way when you want to add much more of your own header files. You have to copy many times. There must be one simpler way to solve this problem by using system path or something else. But, I didn't solve it in this method totally.
Last, good luck. Hope it will be helpful.

what does #include <crtdll/stddef.h> mean?

I am trying to compile the Scintilla control with MSVC++ 2010 Express Edition, and it's quite painful getting it to work right because I need a bunch of files. When compiling SString.h, I noticed this:
#include <crtdll/stddef.h>
I am no C++ programmer, but I do understand what
#include <xxx.h>
means, but what does the the that include mean? I get the following error with it:
Error 1 error C1083: Cannot open include file: 'crtdll/stddef.h': No such file or directory f\scintilla\lexers\sstring.h 44
Any help on how I could fix it would be appreciated.
If I am not mistaken, that is just a relative path. In other words, Visual Studio will look for stddef.h in the crtdll subdirectory of, probably, the root directory of the project.
By using the preceding function, you are summoning, and subsequently inserting a header file into your current source code.
In the case of #include <crtdll/stddef.h> you will be inserting the stddef.h header file from the crtdll directory (which should be a child folder defined in your compiler as the holding pen for header files) during the compilation and linking of your program.
By inserting the stddef.h header file into your source you are giving your program the capability to wield NULL pointer constants, which are exceedingly useful in some of the more advanced programs you may or may not have come across.
Good luck with your program!
I am no C++ programmer, but I do understand what
are you sure?
include with <> searches the include paths for the specified file and copies the content the content of that file in your .cpp.
So you are just missing the crtdll/stddef.h file, however stddef.h actually belongs to the C standardlibrary so you might replace it with #include in C or #include in C++
The easiest way would be to check your include directories. crtdll is the C standard library provided by msvc, so maybe you have to add the parent folder of your standard library include directory
This means that stddef.h needs to be included from the crtdll folder.
You need to check your include directories for Visual C++ projects to see that which are the default directories from where Visual Studio looks up for header files.
To fix this error, see that at which path have you installed the Scintilla control. The crtdll folder will be there most probably. And then, add this folder to your visual studio include directories.
You can set it in the following project properties dialog:
Here http://i56.tinypic.com/2zo9guh.jpg