Error in 'make'
(base) C19DMGD:CAFE leyu$ make g++ -c -Wall -std=c++11 -I cafe -I libtree -I libcommon -O3 -DNDEBUG -o release/cafe_commands.o cafe/cafe_commands.cpp cafe/cafe_commands.cpp:1065:12: error: call to 'abs' is ambiguous return std::abs(x - y) <= epsilon * std::abs(x); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:132:6: note: candidate function int abs(int) __pure2; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ cafe/cafe_commands.cpp:1065:41: error: call to 'abs' is ambiguous return std::abs(x - y) <= epsilon * std::abs(x); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:132:6: note: candidate function int abs(int) __pure2; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ 2 errors generated. make: *** [release/cafe_commands.o] Error 1
See https://github.com/hahnlab/CAFE/issues/77
Thanks for your so quick reply. I have little knowledge in C, you suggested to add #include to cafe/cafe_commands.cpp, what do you mean?
Here, I opened that file using Sublime, we can see it as below, what should I add (just '#include') and where should I add?
*/ #include "../config.h"
#include <stdio.h> #include <time.h> #include
#include "../config.h"
#if defined(_OPENMP) #include <omp.h> #endif
#include "lambda.h" #include "lambdamu.h" #include "cafe_commands.h" #include "reports.h" #include "pvalue.h" #include "conditional_distribution.h"
Add
#include <cmath>
Just after the line that says
#include "../config.h"
collect2: error: ld returned 1 exit status make: *** [bin/cafexp] error 1 I might had the same problem in the process of 'make' in CAFE5-5.0.0 ,could you please provide modified file,because for people like me who are not good at programming language, how to open it properly is also a problem.Thank you in advance for your help!
@https://github.com/benfulton
Please show all the output from Make that you received.
./configure
checking for icc... no
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for g++ option to support OpenMP... -fopenmp
checking for floor in -lm... yes
checking for library containing sgemm... no
checking for library containing cblas_dgemm... no
checking for library containing cblas_dgemm... no
checking for library containing vdExp... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
make
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/base_model.cpp -o obj/base_model.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/cafexp.cpp -o obj/cafexp.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/clade.cpp -o obj/clade.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/core.cpp -o obj/core.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/error_model.cpp -o obj/error_model.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/execute.cpp -o obj/execute.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gamma_core.cpp -o obj/gamma_core.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gamma.cpp -o obj/gamma.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gene_family.cpp -o obj/gene_family.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gene_family_reconstructor.cpp -o obj/gene_family_reconstructor.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/io.cpp -o obj/io.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/lambda.cpp -o obj/lambda.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/matrix_cache.cpp -o obj/matrix_cache.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/optimizer.cpp -o obj/optimizer.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/optimizer_scorer.cpp -o obj/optimizer_scorer.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/poisson.cpp -o obj/poisson.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/probability.cpp -o obj/probability.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/root_distribution.cpp -o obj/root_distribution.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/root_equilibrium_distribution.cpp -o obj/root_equilibrium_distribution.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/simulator.cpp -o obj/simulator.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/user_data.cpp -o obj/user_data.o
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c main.cpp -o obj/main.o
g++ -std=c++11 -O3 -fopenmp -o bin/cafexp -I. obj/base_model.o obj/cafexp.o obj/clade.o obj/core.o obj/error_model.o obj/execute.o obj/gamma_core.o obj/gamma.o obj/gene_family.o obj/gene_family_reconstructor.o obj/io.o obj/lambda.o obj/matrix_cache.o obj/optimizer.o obj/optimizer_scorer.o obj/poisson.o obj/probability.o obj/root_distribution.o obj/root_equilibrium_distribution.o obj/simulator.o obj/user_data.o obj/main.o -lm
obj/clade.o:在函数‘parse_newick(std::string, bool)’中:
clade.cpp:(.text+0x474d):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits
在函数中:In the function 未定义的引用:undefined reference 跟着更多未定义的参考到:follow more undefined references to
Thanks for your help!
This indicates that the compiler you have is out of date - probably GCC 4.8? You would need to upgrade to at least 4.9. What operating system are you using?
I'm sorry to reply you so late. I use Linux system, and everything was normal when my lab partner installed version 4. So is it because CAFE 4 was not so demanding of the compiler at the time?