我Nana
在编译C++
使用Ubuntu
.Eclipse
我已按照以下安装步骤操作:
https://github.com/qPCR4vir/nana-docs/wiki/Installation
- 我已经
static linkage library
在Eclipse
[OK 编译并且我有我的libNanaStaticLibrary.a库文件] - 我创建了一个
C++ project
- 添加了
include
路径nana
- 将第1
library
点的创建添加到路径 library
X11
还将,添加pthread
到项目库中- 我也在编译这个
C++11
(添加到杂项-std=c++11
:)
到目前为止,一切都很好....
当我尝试编译我的项目时,我得到errors
:
07:24:16 **** Incremental Build of configuration Debug for project Sandbox ****
make all
Building file: ../Sandbox.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include -I/usr/include/freetype2 -I"/home/john/john/workspace/projs/common/nana/include" -O0 -g3 -Wall -c -fmessage-length=0 -std=c++11 -MMD -MP -MF"Sandbox.d" -MT"Sandbox.d" -o "Sandbox.o" "../Sandbox.cpp"
Finished building: ../Sandbox.cpp
Building target: Sandbox
Invoking: GCC C++ Linker
g++ -o "Sandbox" ./Sandbox.o -lX11 -lpthread -lNanaStaticLibrary -L/usr/lib -L/usr/lib/X11 -L/usr/include/X11 -L/usr/lib/x86_64-linux-gnu/X11 -L/usr/lib/x86_64-linux-gnu -L"/home/john/john/workspace/projs/common/nana/lib"
/home/john/john/workspace/projs/common/nana/lib/libNanaStaticLibrary.a(bedrock_posix.o): In function 'nana::detail::bedrock::set_cursor(nana::detail::basic_window*, nana::cursor, nana::detail::bedrock::thread_context*)':
bedrock_posix.cpp: (.text+0xcfb): undefined reference to 'XUndefineCursor'
bedrock_posix.cpp: (.text+0xd77): undefined reference to 'XCreateFontCursor'
bedrock_posix.cpp: (.text+0xdd4): undefined reference to 'XFreeCursor'
...还有更多这样的错误。一切以 X 开头。
我在这里想念什么?
我的代码就是这样简单(从这里检索:http: //nanapro.org/en-us/)
#include <nana/gui.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/widgets/button.hpp>
#include <thread>
int main()
{
using namespace nana;
//Define a form.
form fm;
//Define a label and display a text.
label lab{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};
lab.format(true);
//Define a button and answer the click event.
button btn{fm, "Quit"};
btn.events().click([&fm]{
fm.close();
});
//Layout management
fm.div("vert <><<><weight=80% text><>><><weight=24<><button><>><>");
fm["text"]<<lab;
fm["button"] << btn;
fm.collocate();
//Show the form
fm.show();
//Start to event loop process, it blocks until the form is closed.
exec();
}
这是我的includes
:
和libraries
:
谢谢你。