0

I use Ubuntu 18.04 and try to compile the example 'money.cpp' file that Gecode brings. I downloaded (gecode-release-5.1.0.tar.gz) and extract it. Then to install Gecode I do the following steps:

(1) ./configure (2) make

I get satisfactory installation.

Then I try to compile money.cpp, like this: $g++ money.cpp

and I get the following error:

fatal error: gecode / driver.hh: No such file or directory   #include            ^ ~~~~~~~~~~~~~~~~~

I know the problem is that it does not recognize the libraries, but how can I make my .cpp or compile phase recognize them?

regards! Alberto

1 Answer 1

2

You need to call g++ with the -I flag so that g++ knows where to look for the include files:

g++ -I<dir> money.cpp

<dir> is the source code directory for the files (the one with structure as seen on GitHub):

https://github.com/Gecode/gecode

See Compiling with g++:

https://courses.cs.washington.edu/courses/cse373/99au/unix/g++.html
Sign up to request clarification or add additional context in comments.

2 Comments

Hello Luis D, I put 'g++ -Igecode examples/money.cpp' or 'g++ -I/home/ripi/Desktop/gecode-release-5.1.0/gecode examples/money.cpp' and I get the same error: fatal error: gecode/driver.hh, I'm missing something??
@GMs, You would have to use g++ -I${GECODE_INSTALL_DIR} money.cpp. -I allows you to include header files from other directories/projects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.