1

Resolved

Clang 3.2 Linux Compiler Error

description

When compiling Nana C++11 under Linux using Clang 3.2, I get the following error:
clang++ -g -c ../../source/detail/platform_spec_selector.cpp -o ../../source/detail/platform_spec_selector.o -I../../include -I/usr/include/freetype2 -std=c++0x -Wall
In file included from ../../source/detail/platform_spec_selector.cpp:20:
In file included from ../../source/detail/linux_X11/platform_spec.cpp:18:
../../include/nana/detail/linux_X11/msg_dispatcher.hpp:305:8: warning: variable
      'thr' is used uninitialized whenever 'if' condition is false
      [-Wsometimes-uninitialized]
                                if(i != table_.thr_table.end())
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../include/nana/detail/linux_X11/msg_dispatcher.hpp:314:48: note: 
      uninitialized use occurs here
                        std::unique_lock<decltype(thr->mutex)> lock(thr->mutex);
                                                                    ^~~
../../include/nana/detail/linux_X11/msg_dispatcher.hpp:305:5: note: remove the
      'if' if its condition is always true
                                if(i != table_.thr_table.end())
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../include/nana/detail/linux_X11/msg_dispatcher.hpp:301:23: note: initialize
      the variable 'thr' to silence this warning
                        thread_binder * thr;
                                           ^
                                            = nullptr
In file included from ../../source/detail/platform_spec_selector.cpp:20:
In file included from ../../source/detail/linux_X11/platform_spec.cpp:25:
In file included from ../../include/nana/gui/detail/bedrock.hpp:15:
In file included from ../../include/nana/gui/detail/event_manager.hpp:19:
../../include/nana/gui/detail/handle_manager.hpp:147:9: error: cannot initialize
      a variable of type 'int' with an rvalue of type 'int *'
  ...YouHaveToDefineADeleterForHandleManager3thTemplateParameterForANonPointerHandleType = (int*)0;
     ^                                                                                     ~~~~~~~
1 warning and 1 error generated.
GCC 4.8 works fine, however, but the build fails with this error:
ar: ../bin/libnana.a: No such file or directory
That can be resolved by putting a line labeled make -p ../bin before the line that calls ar.

comments

cnjinhao wrote Apr 24, 2014 at 9:47 PM

Thank you for reporting this issue.