Descriptions: I'm tring to conform a part of matlab source to C++. The matlab source calls a matlab lib named Manopt for params optimizing, So I found a lib in C++ named ROPTLIB(
http://www.math.fsu.edu/ROPTLIB/) to realize the same optimization as Manopt. The problem occured when I download ROPTLIB and try to run the example demo in ROPTLIB user manual. I wrote a CMakeLists.txt(as follow) to compile the lib source code, for there is no compiling tools in lib diretory(except matlab script, but I want the lib run in pure C++ environment in my ubuntu 14.04LTS). The package of lapack and blas are also link to project as you can see in CMakelists.txt. I try to search the Problem both in stackoverflow and other open forums, but no one can help me. If you have any experience for debug locale_facets_nonio.tcc:918:22: error: expected unqualified-id before or ROPTLIB, printing it blow mat help me. Thanks!
CMakeLists.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
SET(ProjectName TestProductExample)
PROJECT(${ProjectName})
FILE(GLOB_RECURSE all_files
"${CMAKE_CURRENT_SOURCE_DIR}/Solvers/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Problems/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Others/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/*.cpp"
)
INCLUDE_DIRECTORIES(
"${CMAKE_CURRENT_SOURCE_DIR}/Solvers/"
"${CMAKE_CURRENT_SOURCE_DIR}/Problems/"
"${CMAKE_CURRENT_SOURCE_DIR}/Problems/StieSumBrockett/"
"${CMAKE_CURRENT_SOURCE_DIR}/Others/"
"${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/"
"${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Stiefel/"
"${CMAKE_CURRENT_SOURCE_DIR}/Manifolds/Euclidean/"
"${CMAKE_CURRENT_SOURCE_DIR}/blas/"
"${CMAKE_CURRENT_SOURCE_DIR}/lapack/"
)
message(STATUS "add include_directories " ${INCLUDE_DIRECTORIES})
if(${CMAKE_COMPILER_IS_GNUCC})
message (STATUS "add c++11 flags")
add_definitions(-Wall -s -std=c++11 )
endif()
set(LIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/;${LIB}")
message (STATUS "blas and lapack lib is in ${LIB}")
add_executable(${ProjectName} ${CMAKE_CURRENT_SOURCE_DIR}/test/TestProductExample.cpp ${all_files})
link_directories({${LIB}})
target_link_libraries(${ProjectName} lapack_LINUX.a blas_LINUX.a tmglib_LINUX.a)
message (STATUS "CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}, CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
message (STATUS "CMAKE_COMPILER_IS_GNUCC is ${CMAKE_COMPILER_IS_GNUCC}")`
errors log:
[ 1%] Building CXX object CMakeFiles/TestProductExample.dir/test/TestProductExample.cpp.o
In file included from /usr/include/c++/4.7/bits/locale_facets_nonio.h:1903:0,
from /usr/include/c++/4.7/locale:43,
from /usr/include/c++/4.7/iomanip:45,
from /home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Manifolds/Manifold.h:23,
from /home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Problems/Problem.h:16,
from /home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/test/TestProductExample.cpp:20:
/usr/include/c++/4.7/bits/locale_facets_nonio.tcc: In member function ‘_InIter std::time_get<_CharT, _InIter>::_M_extract_name(std::time_get<_CharT, _InIter>::iter_type, std::time_get<_CharT, _InIter>::iter_type, int&, const _CharT**, std::size_t, std::ios_base&, std::ios_base::iostate&) const’:
/usr/include/c++/4.7/bits/locale_facets_nonio.tcc:918:22: error: expected unqualified-id before ‘(’ token
In file included from /home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/test/TestProductExample.cpp:15:0:
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h: At global scope:
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:69:13: warning: ‘void next_state()’ declared ‘static’ but never defined [-Wunused-function]
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:64:22: warning: ‘randgen::state’ defined but not used [-Wunused-variable]
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:65:12: warning: ‘randgen::left’ defined but not used [-Wunused-variable]
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:66:12: warning: ‘randgen::initf’ defined but not used [-Wunused-variable]
/home/wangyuanjiang/Documents/software/ROPTLIB_2016-04-29_CPP/Others/randgen.h:67:23: warning: ‘randgen::next’ defined but not used [-Wunused-variable]
make[2]: *** [CMakeFiles/TestProductExample.dir/test/TestProductExample.cpp.o] Error 1
make[1]: *** [CMakeFiles/TestProductExample.dir/all] Error 2
make: *** [all] Error 2