I'm trying to build a C++ program, that needs lipqxx functionalities. I'm on Ubuntu and I'm trying to use Kdevelop.
I did it successfully with Code::Blocks, but I'm trying to find a better IDE.
Now, what I've done with Kdevelop. I created a simple example:
#include <pqxx/pqxx>
int main(int argc, char **argv) {
pqxx::connection c("dbname=xx host=localhost user=xx password=xx");
return 0;
}
I modified the CmakeList.txt to include the pqxx directory and to link with libpqxx.so:
cmake_minimum_required(VERSION 2.6)
project(testkdev)
include_directories ("/usr/include/pqxx")
LINK_DIRECTORIES("/usr/lib")
add_executable(testkdev main.cpp)
TARGET_LINK_LIBRARIES(testkdev libpqxx.so)
install(TARGETS testkdev RUNTIME DESTINATION bin)
At this point, the build process works.
But I need to do something else, I want to work in C++11. So I add a -std=c++11 option, right clicking on my project, Open Configuration > Cmake > Advanced Values > CMAKE_CXX_FLAGS.
And I get the following errors:
/home/francis/projects/testKDEV/build> make -j2
[100%] Building CXX object CMakeFiles/http://ift.tt/1d9kMbb
In file included from /usr/include/c++/4.9/memory:79:0,
from /usr/include/c++/4.9/tr1/memory:39,
from /usr/include/pqxx/util.hxx:31,
from /usr/include/pqxx/util:18,
from /usr/include/pqxx/except.hxx:27,
from /usr/include/pqxx/except:19,
from /usr/include/pqxx/result.hxx:33,
from /usr/include/pqxx/result:19,
from /usr/include/pqxx/binarystring.hxx:26,
from /usr/include/pqxx/binarystring:18,
from /usr/include/pqxx/pqxx:17,
from /home/francis/projects/testKDEV/main.cpp:2:
/usr/include/c++/4.9/functional:1034:20: error: expected template-name before ‘<’ token
: tuple_element<__i, _Tuple> { };
^
/usr/include/c++/4.9/functional:1034:20: error: expected ‘{’ before ‘<’ token
/usr/include/c++/4.9/functional:1034:20: error: expected unqualified-id before ‘<’ token
/usr/include/c++/4.9/functional:1054:17: error: ‘tuple_size’ was not declared in this scope
(__i < tuple_size<_Tuple>::value)>
^
/usr/include/c++/4.9/functional:1054:35: error: ‘::value’ has not been declared
(__i < tuple_size<_Tuple>::value)>
and it goes on and on with errors... Could anybody please help me understanding what I'm doing wrong ?
Aucun commentaire:
Enregistrer un commentaire