I am getting the following error when trying to use
#include <vtkViewNode.h>
in my code. I didn't do anything else besides this. I am getting the following error message:
.../VTK-8.0.1/Rendering/SceneGraph/vtkViewNode.h:29:62: fatal error:vtkRenderingSceneGraphModule.h: No such file or directory
compilation terminated.
Everything else i tried so far is working like cylinders or parametric splines. I might be mistaken but if i try searching for "RenderingSceneGraph" on fossies.org there's no match. So to me it seems like it's not part of the VTK 8.0.1 in the first place.
It's needed for several classes according to their documentation. It's strange though since you can't access any information about it.
Any ideas?
Somebody had basically the same problem just the other day: Error C1083 Cannot open include file: 'vtkGUISupportQtOpenGLModule.h': No such file or directory
vtk****Module.h are files generated by CMake when you are configuring the project, that's why you can't find them in a file search of the source code. You have to enable them explicitly, they are among the "advanced" items in the CMake configuration list, then they will be created as you do CMake -> Generate.
It's not clear to me from your comments above whether you are building VTK on your own or if you are using some kind of precompiled package, but in the latter case, I am affraid your package might not be compiled with the vtkRenderingSceneGraph Module and you will have to compile it on your own. Luckily it's not a big problem, you can get some pointers here https://www.vtk.org/Wiki/VTK/Configure_and_Build but in general it's pretty smooth when you use CMake.
Related
Introduction
I am trying to use Toulbar2 as a C++ library in my CMake project, however I am having much trouble linking it to my main executable.
I found many similar questions on this topic, both here and on other similar website, but none of them helped me with my specific issue. I tried literally everything and I did not menage to make it work, I was hoping that some of you may help me with that.
I am running Ubuntu 18.04, CMake version 3.23 and in my project I am using the standard C++11. I am a proficient programmer, but I am just an beginner/intermediate user of both C++ and CMake.
What I've already tried to do
I cannot list all my attempts, so I will only mention those I think are my best ones, to give you an idea of what I may be doing wrong.
1) In my first attempt, I tried to use the same approach I used for any non-standard library I imported, i.e. using find_package() in CMakeLists.txt to then link the found LIBRARIES and include the found INCLUDE_DIRS. However, I soon realised that Toulbar2 provides neither a Find<package>.cmake or <name>Config.cmake file. So, this approach could not work.
2) My second attempt is the one that in my opinion brought me the closest to the solution I hoped for. You can easily compile Toulbar2 as a dynamic library using the command: cmake -DLIBTB2=ON .. in an hypothetical build directory you previously created. After compiling with make you have your .so file in build/lib/Linux. After installation, you can make CMake find this library by itself using the command find_library. So, my CMakeLists.txt ended up looking like this:
[...]
find_library(TB2_LIBRARIES tb2)
if(TB2_LIBRARIES)
set(all_depends ${all_depends} ${TB2_LIBRARIES})
else(TB2_LIBRARIES)
add_compile_definitions("-DNO_TB2")
message("Compiling without Toulbar2, if you want to use it, please install it first")
endif(TB2_LIBRARIES)
[...]
target_link_libraries(main ${all_depends})
[...]
This code works to some extent, meaning that CMake correctly finds the library and runs the linking command, however if I try to #include <toulbar2lib.hpp> the header is not found. So I figured out I should have told CMake where to find that header, so I ended up adding a
include_directories(/path/to/header/file's/directory)
However, I still have another problem. The header is found, but a lot of names used in the header are not found at compilation time. The reason is that in Toulbar2 some variables/types are defined conditionally by using preprocessing directives like #ifdef or #ifndef, and in turn the global variables used in these conditions are defined through CMake at compilation time. If you are interested in an example, I can mention the Cost type that is used in the mentioned header file. I see that there's a piece missing in the puzzle here, but I cannot figure out which one. Since I pre-compiled the library those definitions should exist when I include the header file, because I am correctly linking the correspondent library that contains those definitions.
3) My third attempt is less elegant than the the other two I mentioned, but I was desperately trying to find a solution. So, I copied the whole toulbar2 cloned folder inside my project and I tried to add it as a subdirectory, meaning that my main CMakeLists.txt contains the line:
add_subdirectory(toulbar2)
It provides a CMakeLists.txt too, there should be no problem in doing it. Then I include the src directory of toulbar2, that contains the header file I need, and I should be okay. Right? Wrong. I got the same problem that I had before with (2), i.e. some variables/types conditionally defined were not actually defined when I tried to compile my project, even though the subproject toulbar2 was correctly (no errors) compiled.
I just wanted to mention that any answer is welcome, however if you could help me figure out an elegant solution (see 1 or 2) for this problem it would be way better, as this code is intended to be published soon or later. Thank you in advance for your help.
Solution 2) looks fine. You just need to add the following compilation flags -DNDEBUG -DBOOST -DLONGDOUBLE_PROB -DLONGLONG_COST when compiling your project with toulbar2lib.hpp. See github/toulbar2 README.md how to compile without cmake for those flags (except WCSPFORMATONLY that should not by used in this context).
I'd want to use this library in a C++ project I'm working on, but I'm getting the following error:
SFML/Graphics.hpp: No such file or directory
Please help me with a bit simpler solution, if possible. Since I'm very new to all this.
Actually there are various method you let your compiler know where is the file, you can do :
#include <include/SFML/Graphics.hpp>
but some compilers are different and may or may not have files, or just store them differently .
I am pretty sure the issue will be resolved.
and also you can give path to the file when you execute the file just put a -I flag :
-I/path/to/SFML/headers
I am working with the OpenSSL library for C++. I used this library in another project and it worked great. I carried it over to another project today and I'm having issues.
Two of the header files are .h.in files: opensslv.h.in and configuration.h.in.
In the first project, this was not an issue. But in my new project it gives me an error on this line
#include <openssl/configuration.h>
because configuration.h cannot be found:
...\include\openssl\opensslconf.h(14): fatal error C1083: Cannot open include file: 'openssl/configuration.h': No such file or directory
I understand there is no literal configuration.h file but from what I understand that configuration.h.in file should generate a configuration.h file right?
Does anybody have any idea why that might be happening? Maybe I changed something in the project properties?
.h.in is a template for a header file.
.in suffix looks similar to autotools template files, but according to their FAQ, OpenSSL uses their own build system based on Perl.
Anyway, you should call one of the Configure scripts, and build after that. Docs.
I'm unable to comment, but you need to provide more information about your directory structure. What do you mean by "carried it over"? This most likely sounds like it's happening due to something pointing to the wrong directory. What environment are you working in?
First thing I would do is double check that your project environment is looking in the correct directory for include files.
I also just found this answer that may be helpful to you as well: https://stackoverflow.com/a/31322172/2494727
I am a C# developer, and spoiled rotten when it comes to references and dependencies. I am working on a small project now in Visual C++ (Visuial Studio 2017), where I want to use the libtomcrypt and libtommath libraries. I've created a small project and added the 2 projects to my solution:
I have also added my includes:
And I added the dependencies:
However, I still can't build:
Error C1083 Cannot open include file: 'tomcrypt.h': No such file or directory
I am not sure what else I need to do to get the references working and the code to compile. Any pointers is appreciated!
The error message indicates that the compiler can't find the file tomcrypt.h while compiling one of your source files. From the message I would guess that you have a line like the following in your source file:
#include <tomcrypt.h>
(...or perhaps with quotes instead of brackets.) From your screenshot I can see that you've added "...\repos\libtomcrypt-develop\src\headers" to your include path. Is the file tomcrypt.h found directly in that folder, or is it perhaps in a subfolder instead?
Your #include directive will basically append whatever path you give it to each entry in your include path when looking for the file, so if there are subfolders in between, you'll have to expand your #include directive to include those folders.
If this doesn't solve your problem, perhaps try posting the actual full path of where this header file exists on your filesystem, as well as your complete include path value! (The full compiler command from the build log would be useful, as well as the complete error message(s) related to this source file.)
Edit:
The original poster posted a separate answer indicating that the actual problem was that the Visual Studio Project Properties were set correctly, but that he was accidentally trying to build a different Configuration. :(
I was building the project under x86. Once I changed it to x64, it built just fine.
I am trying to complete the Boost.DLL tutorial (http://www.boost.org/doc/libs/master/doc/html/boost_dll/tutorial.html)
However, I'm not able to even compile their source code, I keep getting:
fatal error: boost/dll/import.hpp: No such file or director
I tried manually copying the header files from the repository (https://github.com/apolukhin/Boost.DLL), but even when I copy these into "/usr/include/boost/" I get new errors from the same kind about "boost/predef/os.h".
I've tried reinstalling the complete boost library and everything, but without success.
Since they describe themselves as "Boost.DLL is a header only library. To start with the library you only need to include header"
It seems like there should be an easier way to fix this than go through the include-errors and manually search for the right files on the internet...