简体   繁体   中英

Is there something wrong with my Makefile?

Recently I was trying to run a simple example of library QUESO, here is the information about the library:

http://www.quest-scidac.org/software/queso/

I followed the user manual to write my own Makefile and try to run the example, this is my Makefie:

QUESO_DIR = /project/xfu/apps/queso-0.56.1
BOOST_DIR = /share/apps/boost-1.57
GSL_DIR = /project/cacds/apps/gsl/1.16

INC_PATHS = -I$(QUESO_DIR)/include -I$(BOOST_DIR)/include/boost -I$(GSL_DIR)/include/gsl

LIBS = \
-L$(QUESO_DIR)/lib -lqueso \
-L$(BOOST_DIR)/lib -lboost_program_options \
-L$(GSL_DIR)/lib -lgsl 

CXX = mpic++
CXXFLAGS += -g -Wall -c

default : all
.SUFFIXES : .o .C
all : example_sip
clean :
    rm -f *~
    rm -f *.o
    rm -f simple_sip_example

example_sip : example_main.o example_likelihood.o example_compute.o
    $(CXX) example_main.o \
           example_likelihood.o \
           example_compute.o \
           -o simple_sip_example $(LIBS)
%.o: %.C
    $(CXX) $(INC_PATHS) $(CXXFLAGS) $(LIBS) $<

This is the Makefile on the user manual:在此处输入图片说明

I followed the user manual and only changed the library path. But when I type make -f Makefile_1 , I got these errors:

mpic++ -I/project/xfu/apps/queso-0.56.1/include -I/share/apps/boost-1.57/include/boost 
-I/project/cacds/apps/gsl/1.16/include/gsl -g -Wall -c 
-L/project/xfu/apps/queso-0.56.1/lib -lqueso -L/share/apps/boost-1.57/lib 
-lboost_program_options -L/project/cacds/apps/gsl/1.16/lib -lgsl  example_main.C
In file included from /project/xfu/apps/queso-0.56.1/include/queso/Environment.h:38,
             from example_compute.h:28,
             from example_main.C:25:
/project/xfu/apps/queso-0.56.1/include/queso/ScopedPtr.h:44: error: ISO C++ forbids declaration of 'unique_ptr' with no type
/project/xfu/apps/queso-0.56.1/include/queso/ScopedPtr.h:44: error: typedef name may not be a nested-name-specifier
/project/xfu/apps/queso-0.56.1/include/queso/ScopedPtr.h:44: error: expected ';' before '<' token
In file included from example_compute.h:28,
             from example_main.C:25:
/project/xfu/apps/queso-0.56.1/include/queso/Environment.h:380: error: 'Type' in class 'QUESO::ScopedPtr<QUESO::GetPot>' does not name a type
make: *** [example_main.o] Error 1

You can see these errors came from the header file of the library. Source file is from the library, I only wrote the Makefile. I run this example in a school cluster, there shouldn't be any problem on the library because the IT installed it. So I guess the problem may come from my Makefile, but I just followed the user manual. Thank you very much!

The problem solved. It's because of the C++11 standard. It seems that QUESO was built with C++11 by default, but my gcc version didn't support C++11. After updating gcc and rebuilt the library, make sure using -std=c++11 , there is no such problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM