help with clang error: array initializer must be an initializer list

Mojca Miklavec mojca at macports.org
Thu Sep 5 00:21:18 PDT 2013


Hi,

I'm not really a maintainer, but for the bunch of wxWidgets updates I
had to fiddle a bit with Code::Blocks.

Jeremy asked me if it was possible to make the software compile with
clang. I fixed one compile error (which has already been fixed
upstream), but I'm stuck with the following:

librariesdlg.cpp:93:7: error: array initializer must be an initializer list
    , m_WorkingCopy(knownLibraries)
      ^
1 error generated.


I do know some C/C++, but I don't know how to fix that problem. Below
are some possibly relevant chunks of the code that could provide a
clue.

(I reported the bug upstream:
http://developer.berlios.de/bugs/?func=detailbug&bug_id=19111&group_id=5358)


enum LibraryResultType
{
    rtDetected = 0,     ///< \brief Cnofiguration detected by lib_finder
    rtPredefined,       ///< \brief Predefined configuration
    rtPkgConfig,        ///< \brief Library provided by pkg-config
    ///////
    rtCount,            ///< \brief Here will be the number of result types
    rtUnknown = -1      ///< \brief Used for unknown result types
};

class ResultMap { ... }
typedef ResultMap TypedResults[rtCount];

class LibrariesDlg: public wxScrollingDialog
{
  ...
  private:
    TypedResults& m_KnownLibraries;
    TypedResults m_WorkingCopy;
  ...
}

LibrariesDlg::LibrariesDlg(wxWindow* parent, TypedResults& knownLibraries)
    : m_KnownLibraries(knownLibraries)
    , m_WorkingCopy(knownLibraries)
    , m_SelectedConfig(0)
    , m_WhileUpdating(false)
{
  ...
}


librariesdlg.cpp:93:7: error: array initializer must be an initializer list
    , m_WorkingCopy(knownLibraries)
      ^
1 error generated.



/bin/sh ../../../../libtool --tag=CXX   --mode=compile
/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I../../../../src/include
-I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib/wx/include/gtk2-unicode-release-2.8
-I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/include/wx-2.8
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
-I../../../../src/include -I../../../../src/sdk/wxscintilla/include
-I./../wxContribItems/wxFlatNotebook/include
-I../../../../src/include/scripting/include
-I../../../../src/include/scripting/sqplus
-I../../../../src/include/scripting/squirrel
-I../../../../src/include/scripting/bindings
-I../../../../src/include/mozilla_chardet  -I/opt/local/include
-Ulinux -Uunix  -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64
-DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT
projectmissinglibs.lo -MD -MP -MF .deps/projectmissinglibs.Tpo -c -o
projectmissinglibs.lo projectmissinglibs.cpp
libtool: compile:  /usr/bin/clang++ -DHAVE_CONFIG_H -I.
-I../../../../src/include
-I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib/wx/include/gtk2-unicode-release-2.8
-I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/include/wx-2.8
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__
-I../../../../src/include -I../../../../src/sdk/wxscintilla/include
-I./../wxContribItems/wxFlatNotebook/include
-I../../../../src/include/scripting/include
-I../../../../src/include/scripting/sqplus
-I../../../../src/include/scripting/squirrel
-I../../../../src/include/scripting/bindings
-I../../../../src/include/mozilla_chardet -I/opt/local/include -Ulinux
-Uunix -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64
-DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT
projectmissinglibs.lo -MD -MP -MF .deps/projectmissinglibs.Tpo -c
projectmissinglibs.cpp  -fno-common -DPIC -o
.libs/projectmissinglibs.o
librariesdlg.cpp:93:7: error: array initializer must be an initializer list
    , m_WorkingCopy(knownLibraries)
      ^
1 error generated.

Thank you,
    Mojca


More information about the macports-dev mailing list