FlorentAvellaneda / EvalMaxSAT

State-of-the-art MaxSAT Solver & Library Based on Unsat Core Guided Techniques
GNU General Public License v3.0
14 stars 4 forks source link

Trying to use as a lib #3

Closed anirjoshi closed 1 year ago

anirjoshi commented 1 year ago

When I try to compile using g++ the main.cpp program. I see the following error

main.cpp:6:10: fatal error: EvalMaxSAT.h: No such file or directory
    6 | #include "EvalMaxSAT.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.

Then after locating the EvalMaxSAT.h in lib/EvalMaxSAT/src directory, and replacing the header with #include "lib/EvalMaxSAT/src/EvalMaxSAT.h", I encounter another error:

In file included from main.cpp:6:
lib/EvalMaxSAT/src/EvalMaxSAT.h:9:10: fatal error: communicationlist.h: No such file or directory
    9 | #include "communicationlist.h"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Do we have to manually correct paths of all headers or am I missing something? (I am a bit new to looking into large software systems) Thanks a lot!

FlorentAvellaneda commented 1 year ago

The project uses cmake. You can compile in the following way:

mkdir build
cd build
cmake ..
make

Then to execute : ./EvalMaxSAT_bin --help

anirjoshi commented 1 year ago

After adding a line std::cout << "SOME RANDOM STRING\n"; at the start of the main function in main.cpp, and executing the above commands, I am unable to see the output! Thanks! Actually, I wanted to use this tool as a Library, the readme just says, You can reuse and adapt the CMakeLists.txt file to compile. I do not know how to adapt cmakelists file. Can someone give an example?

anirjoshi commented 1 year ago

Ok! I changed the CMakeLists.txt file. Added the following and it seems to work with this!

add_executable (main main.cpp)

    target_link_libraries(main
        ${LIB_LINK}
    )

Thanks!