Cannot use nana library

2019-08-07 12:07发布

I try to use Nana library with Code::Block IDE. I made all settings like here

and add -std=C++11 flag and Boost include path but it's print next error on building:

nana/include/nana/paint/graphics.hpp|143|error: ‘unsigned int nana::paint::graphics::bidi_string(const nana::point&, const char*, std::size_t)’ cannot be overloaded|
nana/include/nana/paint/graphics.hpp|142|error: with ‘unsigned int nana::paint::graphics::bidi_string(const nana::point&, const char_t*, std::size_t)’|

I only start study C++ 11 standart and Nana GUI library and cannot understand these bugs.

标签: c++11 nana
1条回答
一纸荒年 Trace。
2楼-- · 2019-08-07 12:42

I faced the same problem. To solve problem I look at how nana it self deal with this problem by compiling nana with make VERBOSE=1, and take defines from it.

So to compiled example:

#include<nana/gui.hpp>

int main()
{
     using namespace nana;
     form fm;
     drawing{fm}.draw([](paint::graphics& graph){
         graph.string({10, 10}, L"Hello, world!", colors::red);
     });
     fm.events().click(API::exit);
     fm.show();
     exec();
}

from nana site(http://nanapro.org/en-us/) I use such command line:

g++ -DNANA_ENABLE_PNG -DNANA_LIBPNG -DNANA_LINUX -DNANA_UNICODE \
-DNANA_X11 -DPLATFORM_SPEC_HPP="<nana/detail/linux_X11/platform_spec.hpp>" \
-DSTD_CODECVT_NOT_SUPPORTED -std=c++11 -I nana/include/ \
test.cpp build/libnana.a -lX11 -lXft -lpthread -lpng
查看更多
登录 后发表回答