2

I am trying to make a lightweight GUI application in C++ and I was suggested to use the Nana library.

I downloaded the zip file but I don't know how to proceed. I unzipped it and according to the instructions, I have to

Create a static linkage library solution within a IDE which you use, and add >all the files which are placed in NanaPath/source and in all its sub >directories to the solution. Then compile the solution and you will get a >static linkage file NanaStatic in the path NanaPath/build/bin/IDEName.

(Step Two)

What I don't understand is that, how to "create a static linkage library"? I am not using any IDEs (and most likely I am not going to). All I have now is the unzipped files. I am using MinGW g++ compiler.

I have already read the following posts (not allowed to post more than two links)

How to create a static library with g++?

How to compile nana into static lib

Creating static library from multiple sources

but I could not find a direct way to build and use Nana.

Would you provide me with some guides? I suppose that I can proceed to build my application if I know how to compile the HelloWorld example (directly quoted here).

#include <nana/gui/wvl.hpp>
#include <nana/gui/widgets/label.hpp>

int main()
{
    using namespace nana;
    form    fm;
    label   lb(fm, fm.size());
    lb.caption(STR("Hello, World"));
    fm.show();
    exec();
}

Thanks in advance.

Update: error (a small part only):

enter image description here

Community
  • 1
  • 1
tony_chow
  • 41
  • 4

2 Answers2

1

Looking at the folder structure of Nana, at the root folder there is a build folder. Under it, two folders jump to my attention:

  • makefile
  • cmake

I haven't used cmake that much, but have used a fair amount of makefiles to compile projects. You should be able to start your build efforts by going into build/makefile and executing the command make (if you are under linux). This will kick off the compilation and build process.

After this, the only thing you need to do is link to the output library when you compile your HelloWorld example.

  • Sorry that I am still getting stuck: I am a Windows XP user and I don't know anything about `make`. Is `make.exe` (if it is the Windows version of `make`) the same one as the one in `msys`? I tried that but it results in a compilation error. – tony_chow Jun 07 '15 at 14:25
  • No worries! To be honest, I never used MinGW when in windows. I have used make make from cygwin thought, and that worked for me. You might want to take a look at https://www.cygwin.com/. Additionally, if you are under windows xp, consider giving Visual Studio community edition a try - I know you said you dont want to use IDEs, but Nana can also be compiled Visual Studio (it even have a solution ready under build) – Dennis C Furlaneto Jun 07 '15 at 15:35
  • ar sorry but still having problems here: I installed cygwin and tried to use `make` to build the library. If I interpret the steps correctly I should first `cd` the `makefile` directory and then `make` (it is correct?). However this results in something similar to a compilation error. (see the error information update in my post) – tony_chow Jun 08 '15 at 02:58
  • 1
    Search for c++0x inside the makefile and change that to c++11. If it doesnt work after the change, try compiling it with visual studio - I think it is your best bet given that you are not familiar with cmake and makefile – Dennis C Furlaneto Jun 08 '15 at 19:19
  • I think I will resort to Visual Studio later... anyway thanks. – tony_chow Jun 09 '15 at 03:03
1

Your GCC version is too old. However, Nana has the logic to recognize that and work around it. I don't know why it's not detecting it correctly. Try using the makefile in build/makefile-bkl instead and use the make command make CXXFLAGS=-DSTD_NUMERIC_CONVERSIONS_NOT_SUPPORTED to work around it.

kirbyfan64sos
  • 10,377
  • 6
  • 54
  • 75
  • I dont use MinGW. Could [you see this](https://github.com/qPCR4vir/nana-docs/issues/1#issuecomment-110283058) – qPCR4vir Jun 10 '15 at 19:02