How to include Boost.DLL into C++ code? - c++

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

Related

Custom precompiled headers causing compile errors

I am trying to introduce precompiled headers into my project because of long compile times in my project right now. I have a main project that includes a main function and all the real code is in the DLL project(they are linked together.) I named my precompiled header "vpch.h" and i created a vpch.cpp that includes vpch.h. I am using visual studio 2017 so I went into the properties of vpch.cpp and selected Create. Then I added vpch.h as the first thing in all my cpp files. All files are set to use precompiled headers and reference vpch.h Every CPP files throws the error:
Error C1010 unexpected end of file while looking for precompiled header.
Did you forget to add '#include "vpch.h"' to your source?
I am at a loss as to what to do because I have followed many tutorials and can't find a reason for this. As well as most issues that pop up on google are people just accidentally including precompiled headers.
My only thought is that maybe in the section in properties where it asks for the name of the precompiled header, I need to do more than put "vpch.h" and maybe an exact file location? Any help with this is super appreciated.
EDIT
From further debugging it would appear that all but ONE cpp file is throwing an error. The one that doesn't throw an error is the one that exists in the same exact folder as the vpch.h. So files that can't just write #include "vpch.h" and have to write something like "../vpch.h" I can write #include <vpch.h> and I am going to try that now but I am unsure that will help.
The issue was with every CPP file that wasnt in the same folder as the precompiled header.
So if you use a file structure that contains different classes in different folders, using
#include "../../vpch.h" will actually fail. You must add the root folder to your additional include directories and then use #include <vpch.h> for all files. I can NOT tell you why using #include "../../vpch.h" wasn't working. It seems counter intuitive for it to fail in my opinion.
It may be because it searches for the precompiled header in the same folder as the file you are referencing it in. This answer, however, will work as a solution.

Using ODEINT on codeblocks

I'm trying to install ODEINT on codeblocks to try to write a program that solves ODEs. I've never used external libraries before so I have no idea on how to get started.
After spending a while searching online and watching videos on youtube, here's what I've tried to do:
I downloaded the Odeint zip file from http://headmyshoulder.github.io/odeint-v2/index.html. After uncomprssing it I found a bunch of header files in its sub folders ( but no .libus files).
I've read that one way to being using it is to create a project and then add all the header files found in the odeint file. However you also need to to use the linker to link a .libus file, which I could not find. I found this confusing and didn't get too far with it.
2.The other thing I tried to do was use a empty file and save it as .cpp in a new folder (I usually work with such files, not projects). Then I dug through the odeint file to find odeint.hpp, which I copied and saved in the same folder as my .cpp file, then I included #include "odeint.hpp" and saved the remaining
odeint files ( ie. the directory ) in the same folder, so that during compilation c++ could find them using odeint.hpp.
This didn't work either.
I've a tried bunch of other things as well that I found online. I didn't really understand them and followed the instructions but nothing worked. I get this exact error : fatal error: boost/numeric/odeint.hpp: No such file or directory in all cases
If someone could help me with installing and using ODEINT, I'd really really appreciate it

vtkRenderingSceneGraphModule.h missing

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.

Automake issue with linking

I'm working on a library that links another library to use its static functions.
Everything was working perfectly until I switched from including all my code in the header file to sharing it between the .h and .cpp file.
I tried to use ./configure --prefix="<same path as before>" and then make install but ended up with a "/usr/bin/install: cannot stat .libs/<library name>.so.0.0.0': No such file or directory" error. (also, I did change my makefile to accommodate for the inclusion of the .cpp file)
Then, trying to compile my old library (which should've still worked since the linked library didn't make install correctly and was still technically using the older version) I get a pile of errors that seem to have to do with c++ itself. For example:
.../gcc/4.9.1/linux64/include/c++/4.9.1/bits/stl_bvector.h:354:13: error: expected ';' at end of member declaration
There are an absolute ton of errors similar to the one above, all having to do with issues in the path .../gcc/4.9.1/linux64/include/c++/4.9.1/
Has anyone run into this error before? Let me know if I need to provide any more information, it's just that I've never had this happen so I'm at a loss as to where to proceed. It's likely something simple I'm missing but the longer I stare at it the less it makes sense.
Thanks!
Update: I ended up solving the issue I was having. Basically, the .so file was not being accessed, so I used make clean and then the linked library compiled properly. Next, the issues with the base library was just an extra character within a header file that was causing the compiler to blow up with over 1500 lines of errors. After fixing that, it was able to link up properly and is working fine now.

I am trying to compile in xcode an open source game called supertux but I keep getting file not found errors

The src file is broken down into different libraries and inside each one is the xxx.c and its xxx.h counterpart. In almost all of my classes I get file not found errors on the first import statement for the .h file. I deleted the "library/" and it removes the error. I was wondering if there is an easier way to to this other than going through each of the 1000 classes and doing this for each of the import statements. I have already included sdl framework in the "Link binaries with Libraries". Please help im lost.
Try using the USER_HEADER_SEARCH_PATHS for paths you want searched for #include "..." You can find this option in Build Settings of Target.
You can specify path like this: $(SRCROOT)/Subfolder/subfolder