Help with EIGEN library

Hi all,

I am in a bit of trouble trying to make things work, and hopefully you can help me here.

I have to submit an important project tomorrow, and I have used C++ Eigen library for the main code of the project. In my own laptop, this code runs perfectly, because the compiler has been told beforehand where to find the EIGEN library and read the header files.

However, my problem deals with what the other person might receive. Since it is likely that the recipient does not have the EIGEN library in his system, this may cause trouble if he/she is going to compile the code. I cannot just send the .exe file since Gmail does not allow for this.

So MY QUESTION deals with the following: How do I do to include the Eigen library in my source code project folder, so that the recipient of the source code can compile without any need to download the EIGEN library? I have tried by just copy-pasting the Eigen folder into the source's code folder, but after sending the project to a friend (that is a folder containing both the source code + Eigen folder where all headers are), he has not been able to compile the code. Is there a way to make this work easily, so that ANYONE receiving the project folder will be able to compile the code??

Thanks in advance, I hope you can help!
Its probably just a pathing issue. If your code has fixed paths embedded in it, they have to create the project exactly the same place as you had it, including library folders and all. If you used relative paths, they still need to be correct.

you can send an exe by sending a zip file of the exe, or simply removing the exe extension and letting your friend know to fix it.

you can compile the exe so that it has the library built in and they don't need to do anything, or it can use a dll/shared library type thing that they will need to have with the exe.

do you just want them to be able to run it? If so, if this is visual studio, compile it relase mode and roll the library into the exe with static linking. If its unix etc do the same, but without the release mode (consider running optimizations etc though).

you can also have your friend install the library, if its free (not sure?). That may be better than trying to copy it from you. It is not frowned upon to TELL your consumer that your source depends on installing a 3rd party library and where to get it and such. They can do that.
Last edited on
+Hi jonnin

Thanks for the reply, of course I can just tell them to download the library and install it themselves, but it would be much nicer if I can just make the code compile in any other environment (Im ussing DevC++) that is not mine and that in principle, does not have paths to the Eigen library.
I cannot just send the .exe file since Gmail does not allow for this.

Renaming it to a non-executable extension (such as .txt) works for most email services. Just tell them to rename it back to .exe.

But if you want a more robust solution:

Since Eigen is a header-only library, that actually would make it relatively easy to add to your project. The fact that you say it isn't compiling for your friend means that the path searching is probably getting messed up with however you are trying to export it.

(that is a folder containing both the source code + Eigen folder where all headers are

Are you compiling it in the same way as the way you want your friend to compile. That would be the best. Take what you're emailing to your friend and open it as a completely separate project from what you have, and see if you can compile it. That way, you can see the errors it gives first-hand.

______________________________

Let's say you have two files

some_header.h
main.cpp


In main.cpp, you have #include "some_header.h" .

If you changed your file structure to be
some_folder/some_header.h
main.cpp


You have to update your #include relative path in the same way
#include "some_folder/some_header.h"
Last edited on
Thanks for the replies guys, it has been solved already. It seems like the folder wasn't properly referenciated as a preprocessor order (as you mentioned Ganado). Cheers!
Topic archived. No new replies allowed.