I am trying to set up my environment with C++ and Python.
I need pybind11.
In some files of pybind11 there is the line #include <Python.h> included.
However it tells me
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\d91675\Documents\GitHub\Test_PyBind\PyBind_Add.cpp). C/C++(1696)
cannot open source file "Python.h" C/C++(1696)
I would be happy if you could help me to understand the include functionality.
In places like #include <iostream> I guess this is directly included in the C++ installation.
I can also add modules myself with relative directory like #include "subfolder/module.cpp".
Since I cannot find Python.h within the pybind11 library, I would guess, it is not available.
Do I need to create it with CMake?
e.g. as described here: https://pybind11.readthedocs.io/en/stable/basics.html
Or what could be a reason this Python.h reference is missing?
I am really happy about an explanation for dummies.
Best regards,
Till
Related
I'm developing new features for an old version of Google Chrome (71.0.3578.141).
In the file src/content/browser/devtools/protocol/page_handler.cc, I need to add the following includes:
src/content/browser/devtools/protocol/page_handler.cc:
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
When I execute gn check out/Default, the output is:
ERROR at //content/browser/devtools/protocol/page_handler.cc:8:11: Include not allowed.
#include "chrome/browser/ui/browser_list.h"
^-------------------------------
It is not in any dependency of
//content/browser:browser
The include file is in the target(s):
//chrome/browser/ui:ui
which should somehow be reachable.
___________________
ERROR at //content/browser/devtools/protocol/page_handler.cc:9:11: Include not allowed.
#include "chrome/browser/ui/browser.h"
^--------------------------
It is not in any dependency of
//content/browser:browser
The include file is in the target(s):
//chrome/browser/ui:ui
which should somehow be reachable.
___________________
ERROR at //content/browser/devtools/protocol/page_handler.cc:10:11: Include not allowed.
#include "chrome/browser/ui/browser_window.h"
^---------------------------------
It is not in any dependency of
//content/browser:browser
The include file is in the target(s):
//chrome/browser/ui:ui
which should somehow be reachable.
Sorry but I'm a newbie and I don't know how the GN (Ninja) tool works. I think that I have to modify some BUILD.gn files (or any other GN config files) but I don't know where to start. Please, can anyone help me? Thanks in advance!
I'm new to using MySQL and Boost, and the Q&A in this site have been really helpful so far. However, I have not been able to resolve the following problem. I am using the 'complete example 1' from the 'mysql connector/c++ developer guide'(as a test). Though I have included the boost files in my project I still get the following fatal error: boost/shared_ptr.hpp: No such file or directory
but the this file is in the boost folder. Have I missed out something I should have done?
I have linked a screenshot of my eclipse-cdt showing the error and the missing header file on the left.
even though mysql_connection.h header file has 2 include lines,
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
only one of them show up as an error.
https://drive.google.com/open?id=0BxPDShOqHnvvNERua0NRcTk2Vzg
Your help is much appreciated. Thank you
I just had to change the include folder for boost from
C:\boost_1_63_0\boost to
C:\boost_1_63_0
as the code was looking inside the boost folder.
I'm pretty new to programming and want to use opencv2. I've got a code package and want to run it. It is written in C++ and I want to include several files within opencv2 and the code is:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
My question is why didn't #include give the whole directory like /usr/local/include/opencv2/...?
This code could not run on my computer because I didn't add opencv2 into my include path.
What should I do?
If your compiler does not automatically look for headers under /usr/local/include, then you need to tell it to do so:
g++ … -I/usr/local/include … source.cpp
The reason that you don't put the full path name into the source is that it makes it unportable. You have OpenCV2 installed in /usr/local, I have it in /opt/OpenCV2. The source would have to be hacked horribly if the code said:
#include "/usr/local/include/opencv2/core/core.hpp"
The way it is, people can locate the OpenCV2 library and supporting headers in any location and only have to specify that location on the command line (or in the makefile, or let an auto-configuring tool do the work for you).
Add OpenCV2 into your include path.
You can write an absolute path into your #include directive if you want, but it's sorely frowned upon as it makes your code utterly non-portable.
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.
I'm developing a library that is to be used (after compiled and installed) by another developer. All my includes are like this:
#include "../exception/CException.h"
All goes well but when I install the library and use it in another program with #include <> that include a file that have #include "../exception/CException.h" the last file is not found. Why?
Any help to improve include usage?
The problem with a relative path is that we don't know for sure what it is relative to. Different compilers have different ways of doing this.
You should rather use
#include "yourlib/exception/CException.h"
similar to Boost.
If you install this as a subdirectory yourlib in /usr/local the compiler should be able to find that.
You'll need to distribute ../exception/CException.h with your library. If it's really part of your library putting it in a subdirectory rather than a sibling would be preferable.