google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.14k stars 2.11k forks source link

compilation error with fabs #212

Closed frodrigo closed 8 years ago

frodrigo commented 8 years ago

There is compilation error on

src/sat/boolean_problem.cc: Dans la fonction ‘void operations_research::sat::UseObjectiveForSatAssignmentPreference(const operations_research::LinearBooleanProblem&, operations_research::sat::SatSolver*)’:
src/sat/boolean_problem.cc:234:78: erreur : ‘fabs’ was not declared in this scope
                           fabs(static_cast<double>(objective.coefficients(i))));
                                                                              ^
src/sat/boolean_problem.cc:238:60: erreur : ‘fabs’ was not declared in this scope
         fabs(static_cast<double>(objective.coefficients(i))) / max_weight;
                                                            ^
make: *** [makefiles/Makefile.cpp.mk:1580: objs/sat/boolean_problem.o] Error 1

Missing somewhere #include or #include

lperron commented 8 years ago

Hi,

Can you tell me which platform you are using?

Thanks

Laurent Perron | Operations Research | lperron@google.com | (33) 1 42 68 53 00

2016-07-18 8:02 GMT-07:00 Frédéric Rodrigo notifications@github.com:

There is compilation error on

src/sat/boolean_problem.cc: Dans la fonction ‘void operations_research::sat::UseObjectiveForSatAssignmentPreference(const operations_research::LinearBooleanProblem&, operationsresearch::sat::SatSolver)’: src/sat/boolean_problem.cc:234:78: erreur : ‘fabs’ was not declared in this scope fabs(static_cast(objective.coefficients(i)))); ^ src/sat/boolean_problem.cc:238:60: erreur : ‘fabs’ was not declared in this scope fabs(static_cast(objective.coefficients(i))) / maxweight; ^ make: ** [makefiles/Makefile.cpp.mk:1580: objs/sat/boolean_problem.o] Error 1

Missing somewhere #include or #include

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/or-tools/issues/212, or mute the thread https://github.com/notifications/unsubscribe-auth/AKj17XlhXLQ-VUlqHXiKh8FX0Rmcc82tks5qW5WhgaJpZM4JOzn6 .

frodrigo commented 8 years ago

archlinux with gcc:

$ LANG=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 6.1.1 20160707 (GCC) 
lperron commented 8 years ago

I have added #include Can you update the sources and retry?

frodrigo commented 8 years ago

Compilation is now fine, Thank you.

jmarca commented 7 years ago

This exact bug is hitting me. It seems commit a493cb818e92f63bab97417e5ddcd93240117fd6 took the #include back out. I added it back in and it seems to be compiling fine (make cc is still running)