运行开源代码的makefile时出错2

时间:2016-05-16 21:52:56

标签: makefile open-source

所以我试图从this research paper运行开源代码,但我一直得到[make]错误2.感谢提供代码的makefile所以我所做的就是运行make命令当我在包含makefile的文件夹中时。

我是所有这一切的新手,我从互联网上得到了所有东西,所以如果我有点无知,我会道歉。我正在努力学习,请耐心等待(:

QuantumHoneybees-MacBook-Pro:femflip2 Joe$ make
makeCompiling src/adaptive2.cpp ...
 In file included from src/adaptive2.cpp:13:
./src/kernel.h:16:20: warning: unused function 'smooth_kernel' [-Wunused-function]
    static FLOAT64 smooth_kernel( FLOAT64 r2, FLOAT64 h ) {
                   ^
In file included from src/adaptive2.cpp:15:
./src/util2.h:29:13: warning: unused function 'dump' [-Wunused-function]
static void dump( const char *format, ...) {
            ^
./src/util2.h:45:13: warning: unused function 'run' [-Wunused-function]
static void run( const char *format, ...) {
            ^
./src/util2.h:54:20: warning: unused function 'format_str' [-Wunused-function]
static const char *format_str( const char *format, ...) {
                   ^
./src/util2.h:65:13: warning: unused function 'is_nan' [-Wunused-function]
static bool is_nan(const double v) {
            ^
./src/util2.h:86:17: warning: unused function 'square' [-Wunused-function]
        static FLOAT64 square(FLOAT64 a) {
                       ^
./src/util2.h:120:17: warning: unused function 'getSeconds' [-Wunused-function]
        static FLOAT64 getSeconds() {
                       ^
./src/util2.h:142:15: warning: unused function 'stretchPosition' [-Wunused-function]
        static vec2d stretchPosition( const svd2 &svd, vec2d p, FLOAT64 min, FLOAT64 max, bool inverse=true ) {
                     ^
./src/util2.h:162:28: warning: unused function 'marchPoints' [-Wunused-function]
        static std::vector<vec2d> marchPoints( const std::vector<vec2d> &nodes, const std::vector<FLOAT64> &levelsets, bool fill=true ) {
                                  ^
./src/util2.h:180:17: warning: unused function 'computeVolume' [-Wunused-function]
        static FLOAT64 computeVolume( const std::vector<vec2d> points ) {
                       ^
./src/util2.h:192:17: warning: unused function 'distance' [-Wunused-function]
        static FLOAT64 distance( const vec2d &p0, const vec2d &p1, vec2d &p ) {
                       ^
./src/util2.h:222:17: warning: unused function 'detDelaunay' [-Wunused-function]
        static FLOAT64 detDelaunay( vec2d p0, vec2d p1, vec2d p2, vec2d p3 ) {
                       ^
src/adaptive2.cpp:53:13: warning: unused function 'sampleVelocity' [-Wunused-function]
static bool sampleVelocity( sorter2& sorter, vec2d pos, FLOAT64 dpx, const std::vector<particle2 *> &neighbors, vec2d &vel ) {
            ^
13 warnings generated.
Compiling src/ann/ANN.cpp ...
Compiling src/ann/bd_fix_rad_search.cpp ...
Compiling src/ann/bd_pr_search.cpp ...
Compiling src/ann/bd_search.cpp ...
Compiling src/ann/bd_tree.cpp ...
Compiling src/ann/brute.cpp ...
Compiling src/ann/kd_dump.cpp ...
src/ann/kd_dump.cpp:44:14: warning: unused variable 'EPSILON' [-Wunused-const-variable]
const double    EPSILON                 = 1E-5; // small number for float comparison
                ^
1 warning generated.
Compiling src/ann/kd_fix_rad_search.cpp ...
Compiling src/ann/kd_pr_search.cpp ...
Compiling src/ann/kd_search.cpp ...
Compiling src/ann/kd_split.cpp ...
Compiling src/ann/kd_tree.cpp ...
Compiling src/ann/kd_util.cpp ...
Compiling src/ann/perf.cpp ...
Compiling src/annsorter2.cpp ...
In file included from src/annsorter2.cpp:9:
In file included from ./src/annsorter2.h:10:
In file included from ./src/ann2.h:11:
./src/util2.h:29:13: warning: unused function 'dump' [-Wunused-function]
static void dump( const char *format, ...) {
            ^
./src/util2.h:45:13: warning: unused function 'run' [-Wunused-function]
static void run( const char *format, ...) {
            ^
./src/util2.h:54:20: warning: unused function 'format_str' [-Wunused-function]
static const char *format_str( const char *format, ...) {
                   ^
./src/util2.h:65:13: warning: unused function 'is_nan' [-Wunused-function]
static bool is_nan(const double v) {
            ^
./src/util2.h:86:17: warning: unused function 'square' [-Wunused-function]
        static FLOAT64 square(FLOAT64 a) {
                       ^
./src/util2.h:120:17: warning: unused function 'getSeconds' [-Wunused-function]
        static FLOAT64 getSeconds() {
                       ^
./src/util2.h:142:15: warning: unused function 'stretchPosition' [-Wunused-function]
        static vec2d stretchPosition( const svd2 &svd, vec2d p, FLOAT64 min, FLOAT64 max, bool inverse=true ) {
                     ^
./src/util2.h:162:28: warning: unused function 'marchPoints' [-Wunused-function]
        static std::vector<vec2d> marchPoints( const std::vector<vec2d> &nodes, const std::vector<FLOAT64> &levelsets, bool fill=true ) {
                                  ^
./src/util2.h:180:17: warning: unused function 'computeVolume' [-Wunused-function]
        static FLOAT64 computeVolume( const std::vector<vec2d> points ) {
                       ^
./src/util2.h:192:17: warning: unused function 'distance' [-Wunused-function]
        static FLOAT64 distance( const vec2d &p0, const vec2d &p1, vec2d &p ) {
                       ^
./src/util2.h:222:17: warning: unused function 'detDelaunay' [-Wunused-function]
        static FLOAT64 detDelaunay( vec2d p0, vec2d p1, vec2d p2, vec2d p3 ) {
                       ^

11 warnings generated.
make: *** [all] Error 2
QuantumHoneybees-MacBook-Pro:femflip2 Joe$ make 

编辑:: 我已将其缩小到第36-44行的makefile,但写入的内容有问题。我很遗憾没有编写makefile的经验,所以我不知道如何修复它。我尝试弄乱一些行的缩进,因为其他一些线程似乎有这个问题,但无济于事。

1 个答案:

答案 0 :(得分:0)

include中缺少fluid2.hNULL未定义。

调用

make OPT="-Wall -Os -include cstddef"

或添加

#include <cstddef>

fluid2.h中的包含。

只需重写可怕的包含makefile就行了,试试这个:

CC       := g++
CPPFLAGS := -Isrc -Isrc/ann -Isrc/pcgsolver -MMD -MP
CXXFLAGS := -Wall -Os
LDFLAGS  := -framework OpenGL -framework GLUT

sources := $(wildcard src/*.cpp src/ann/*.cpp)
objects := $(sources:.cpp=.o)
deps    := $(objects:.o=.d)

flip2d: $(objects)
    $(LINK.o) $^ $(LDLIBS) -o $@

.PHONY: clean
clean: ; $(RM) $(objects) $(deps) flip2d

-include $(deps)