2016-10-21 9 views
-1

ubuntu 14.04ltsにROPTLIB(http://www.math.fsu.edu/ROPTLIB/)というオープンソースをコンパイルすると問題が発生します。私は自分でコードをコンパイルするためにCMakeLists.txtを書きます。しかし、私はfollwとしてエラーログで正常にコンパイルすることはできません:私は抽象宣言者 'const <anonymous class>'を宣言として使用C++

//const class { 
//public: 
// template<class T> // convertible to any type 
// operator T*(void) const // of null non-member 
// { 
//  return 0; 
// } // pointer... 
// template<class C, class T> // or any type of null 
// operator T C::*(void) const // member pointer... 
// { 
//  return 0; 
// } 
//private: 
// void operator&(void) const; // whose address can't be taken 
//} nullptr = {}; 

をコメントすると

Scanning dependencies of target TestSimpleExample 
[ 1%] Building CXX object CMakeFiles/TestSimpleExample.dir/test/TestSimpleExample.cpp.o 
In file included from /home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/ForDebug.h:12:0, 
       from /home/xxxg/Documents/software/ROPTLIB_2016-04-29_CPP/test/TestSimpleExample.cpp:11: 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/def.h:140:2: error: expected ‘;’ after class definition 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/def.h:126:14: error: an anonymous struct cannot have function members 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/def.h:140:2: error: abstract declarator ‘const<anonymous class>’ used as declaration 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/def.h:140:4: error: expected unqualified-id before ‘nullptr’ 
In file included from /home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/test/TestSimpleExample.cpp:15:0: 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:69:13: warning: ‘void next_state()’ declared ‘static’ but never defined [-Wunused-function] 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:64:22: warning: ‘randgen::state’ defined but not used [-Wunused-variable] 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:65:12: warning: ‘randgen::left’ defined but not used [-Wunused-variable] 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:66:12: warning: ‘randgen::initf’ defined but not used [-Wunused-variable] 
/home/xxx/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:67:23: warning: ‘randgen::next’ defined but not used [-Wunused-variable] 
make[2]: *** [CMakeFiles/TestSimpleExample.dir/test/TestSimpleExample.cpp.o] Error 1 
make[1]: *** [CMakeFiles/TestSimpleExample.dir/all] Error 2 
make: *** [all] Error 2 

をしかし、それは正常にコンパイルすることができますが、それは間違った答えを得るでしょう。私はGoogleと他のフォーラムの両方で問題を検索しようとしますが、誰も私を助けることはできません。ここ は私のCMakeLists.txtです:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3) 
    3 SET(ProjectName TestSimpleExample) 
    5 PROJECT(${ProjectName}) 
    6 
    7 FILE(GLOB_RECURSE all_files 
    8   "${CMAKE_CURRENT_SOURCE_DIR}/Solvers/*.cpp" 
    9   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/*.cpp" 
10   "${CMAKE_CURRENT_SOURCE_DIR}/Others/*.cpp" 
11   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/*.cpp" 
12 ) 
13 
14 INCLUDE_DIRECTORIES(
15   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/" 
16   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Stiefel/" 
17   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/CpxNStQOrth/" 
18   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/EucPositive/" 
19   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Euclidean/" 
20   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Grassmann/" 
21   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/L2Sphere/" 
22   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/LowRank/" 
23   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Oblique/" 
24   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/OrthGroup/" 
25   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/PreShapeCurves/" 
26   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/SPDManifold/" 
27   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/SPDTensor/" 
28   "${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Sphere/" 
29   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/" 
30   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/ElasticCurvesRO/" 
31   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/EucFrechetMean/" 
32   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/EucPosSpCd/" 
33   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/EucQuadratic/" 
34   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/GrassRQ/" 
35   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/ObliqueTestSparsePCA/" 
36   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/PreShapePathStraighten/" 
37   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/SPDMean/" 
38   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/SPDTensorDL/" 
39   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/SphereConvexHull/" 
40   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/StieBrockett/" 
41   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/StieSoftICA/" 
42   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/StieSparseBrockett/" 
43   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/StieSumBrockett/" 
44   "${CMAKE_CURRENT_SOURCE_DIR}/Problems/WeightedLowrank/" 
45   "${CMAKE_CURRENT_SOURCE_DIR}/Solvers/" 
46   "${CMAKE_CURRENT_SOURCE_DIR}/Others/" 
47   "${CMAKE_CURRENT_SOURCE_DIR}/blas/" 
48   "${CMAKE_CURRENT_SOURCE_DIR}/lapack/" 
49 ) 
54 message(STATUS "add include_directories " ${INCLUDE_DIRECTORIES}) 
55 if(${CMAKE_COMPILER_IS_GNUCC}) 
56  message (STATUS "add c++11 flags") 
58  add_definitions(-Wall -s -std=c++11 -g) 
59 endif() 
60 
61 set(LIB "${CMAKE_CURRENT_SOURCE_DIR}/lib${LIB}") 
62 message (STATUS "blas and lapack lib is in ${LIB}") 
63 #link_directories({${LIB}}) 
64 #link_directories("${OpenBlas_LIB}/lib") 

${CMAKE_CURRENT_SOURCE_DIR}/test/TestProductExample.cpp ${all_files}) 
    71 add_executable(${ProjectName} ${CMAKE_CURRENT_SOURCE_DIR}/test/TestSimpleExample.cpp ${all_files}) 
${CMAKE_CURRENT_SOURCE_DIR}/test/TestStieBrockett.cpp ${all_files}) 
73 message(STATUS "complie src.o successfully") 
78 target_link_libraries(${ProjectName} lapack blas) 
79 
80 message (STATUS "CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}, CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}") 
81 message (STATUS "CMAKE_COMPILER_IS_GNUCC is ${CMAKE_COMPILER_IS_GNUCC}") 

と私のメイク、gccとG ++バージョン:DEF

make -v: 
GNU Make 3.81 
Copyright (C) 2006 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. 
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. 
This program built for x86_64-pc-linux-gnu 

gcc --version: 
gcc (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3 
Copyright (C) 2012 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

g++ --version: 
g++ (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3 
Copyright (C) 2012 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

/ホーム/ XXXX /ドキュメント/ソフトウェア/ ROPTLIB_2016-04-29_CPP /その他/。 h:

+0

組み込みの 'nullptr'を使うときに間違った答えが出たら、おそらくバグが違うからでしょう。 –

答えて

0

nullptrは現在キーワードです。変数には予約されていない識別子を使用して名前を付けてください。

+0

が正常にコンパイルされている間は正しく実行されません。コンパイルの最後にいくつかの警告が表示されます。あなたはそれをデバッグすることができますか? – farever

+0

@fareverそれはどのように動作するのではありません! – usr1234567

関連する問題