'Keywords' is not a namespace-name

亡梦爱人 提交于 2019-12-13 07:12:11

问题


I'm a half decent Java/C# programmer struggling with C++/PoCo.

All the examples I have seen so far have the same line. using namespace Poco::Data::Keywords; In QT, the "Keywords" part is black. I don't know what to "#include" if that would fix it. Codeblocks also fails with the same error => 'Keywords' is not a namespace-name

A small example:

#include <Poco/Format.h>
#include <Poco/Data/MySQL/MySQLException.h>
#include <Poco/Data/Session.h>
#include <Poco/Data/MySQL/Connector.h>
using namespace Poco::Data::Keywords;

int main(int argc, char** argv){
    return 0;
}

I have tried this on a couple of computers. Present one is an Ubuntu 15.10, updated and with the following packages (includes libpoco) + MySQL Client/Server/Workbench.

    1  sudo apt-get install build-essential 
    2  sudo apt-get install qtbase5-dev qtbase5-dev-tools qtbase5-doc   qtbase5-doc-html qtbase5-examples qtbase5-examples-dbg
    3  sudo apt-get install qt5-default qt5-doc-html qt5-doc
    4  sudo apt-get install openssl libssl-dev libssl-doc 
    5  sudo apt-get install libpoco-dev

回答1:


Maybe your library version is older then the one from actual docs you are using. Try this command to find the version:

grep "POCO_VERSION" /usr/include/Poco/*.h

For me it outputs:

/usr/include/Poco/Foundation.h:#define POCO_VERSION 0x01030600

Which mean that poco is only 1.3 ( which does not have Keywords namespace yet ) and not 1.5 ( which does have it ).

If you need latest Poco you can download and install it manually, not using apt.



来源:https://stackoverflow.com/questions/36789269/keywords-is-not-a-namespace-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!