2017-01-23 90 views
-1

最近我尝试运行库QUESO的一个简单的例子,这里是有关库的信息:我的Makefile有什么问题吗?

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

我跟着用户手册,以写我自己的Makefile并尝试运行的例子,这是我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) $< 

这是Makefile的用户手册: enter image description here

我跟着用户手册和只改变了库路径。但是,当我键入make -f Makefile_1,我得到了这些错误:

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 

你可以看到这些错误从库的头文件来了。源文件来自库,我只写了Makefile。我在学校集群中运行这个示例,因为IT安装它,所以应该没有任何问题。所以我想这个问题可能来自我的Makefile,但我只是遵循用户手册。 非常感谢!

+0

你没有按照这个例子,你在'%.o'中加入'$(LIBS)'' – cpatricio

+0

这可能是错误真的出现在你的代码中,如果你在' #include '那么你的代码可能会影响标准头文件。例如,如果你在'ScopedPtr.h'需要的一些常用符号上使用了'#define'等等。从这里提出的问题没有办法告诉问题是什么。 – MadScientist

+0

@cpatricio哦,是的,非常感谢您指出,但即使我在那里删除'$(LIBS)'也是如此。 – Han

回答

0

问题解决了。这是因为C++ 11标准。 似乎QUESO默认是用C++ 11构建的,但我的gcc版本不支持C++ 11。更新gcc并重建库之后,请确保使用-std=c++11,没有这样的问题。