(C++) wchar.h:718: error: expected initializer before 'throw' (while using arm-eabi)
February 24, 2017 · View on GitHub
(C++) 



wchar.h:718: error: expected initializer before 'throw' (while using arm-eabi)
Version of the compile error wchar.h:718: error: expected initializer before 'throw' when using arm-eabi, for example, when creating 'Hello Boost' using Qt Creator under Ubuntu for NDS.
Operating system(s) or programming environment(s)
command line
Qt Creator 2.0.0
Console application
- G++ 4.4.1
Libraries used:
Boost: version 1.40
STL: from GCC,
shipped with Qt Creator 2.0.0
Project file
#------------------------------------------------- # # Project created by QtCreator 2010-10-07T22:25:11 # #------------------------------------------------- INCLUDEPATH += \ /usr/include \ /opt/devkitpro/libnds-1.4.7/include LIBS += \ -lboost_regex \ -L/opt/devkitpro/libnds-1.4.7/lib -lnds9 DEFINES += ARM9 TARGET = CppHelloBoostQtCreatorUbuntuNds CONFIG += console static CONFIG -= app_bundle qt TEMPLATE = app SOURCES += main.cpp QMAKE_CC = /opt/devkitpro/devkitARM/bin/arm-eabi-g++ QMAKE_CXX = /opt/devkitpro/devkitARM/bin/arm-eabi-g++ QMAKE_LINK = /opt/devkitpro/devkitARM/bin/arm-eabi-g++
Makefile used
#--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITARM)),) $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") endif include $(DEVKITARM)/ds_rules #--------------------------------------------------------------------------------- # TARGET is the name of the output # BUILD is the directory where object files & intermediate files will be placed # SOURCES is a list of directories containing source code # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- TARGET := $(shell basename $(CURDIR)) BUILD := build SOURCES := gfx source data INCLUDES := include build \ ../opt/devkitpro/libnds-1.4.7/include \ ../../../../../../../usr/include #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- ARCH := -mthumb -mthumb-interwork CFLAGS := -g -Wall -O2\ -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\ -ffast-math \ $(ARCH) CFLAGS += $(INCLUDE) -DARM9 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map) #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := /usr/lib -lboost_regex -lnds9 #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- LIBDIRS := $(LIBNDS) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions #--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- export OUTPUT := $(CURDIR)/$(TARGET) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C #--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),) #--------------------------------------------------------------------------------- export LD := $(CC) #--------------------------------------------------------------------------------- else #--------------------------------------------------------------------------------- export LD := $(CXX) #--------------------------------------------------------------------------------- endif #--------------------------------------------------------------------------------- export OFILES := $(BINFILES:.bin=.o) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) .PHONY: $(BUILD) clean #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).ds.gba #--------------------------------------------------------------------------------- else DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).nds : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.o : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) -include $(DEPENDS) #--------------------------------------------------------------------------------------- endif #---------------------------------------------------------------------------------------
Makefile generated by qmake
Results in the same error!
############################################################################# # Makefile for building: CppHelloBoostQtCreatorUbuntuNds # Generated by qmake (2.01a) (Qt 4.6.2) on: Sun Oct 10 12:38:55 2010 # Project: ../source/CppHelloBoostQtCreatorUbuntuNds.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ../source/CppHelloBoostQtCreatorUbuntuNds.pro ############################################################################# ####### Compiler, tools and options CC = /opt/devkitpro/devkitARM/bin/arm-eabi-g++ CXX = /opt/devkitpro/devkitARM/bin/arm-eabi-g++ DEFINES = -DARM9 CFLAGS = -pipe -g -Wall -W $(DEFINES) CXXFLAGS = -pipe -g -Wall -W $(DEFINES) INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I../source -I/usr/include -I/opt/devkitpro/libnds-1.4.7/include -I../source -I. LINK = /opt/devkitpro/devkitARM/bin/arm-eabi-g++ LFLAGS = LIBS = $(SUBLIBS) -lboost_regex -L/opt/devkitpro/libnds-1.4.7/lib -lnds9 AR = ar cqs RANLIB = QMAKE = /usr/bin/qmake-qt4 TAR = tar -cf COMPRESS = gzip -9f COPY = cp -f SED = sed COPY_FILE = $(COPY) COPY_DIR = $(COPY) -r STRIP = strip INSTALL_FILE = install -m 644 -p INSTALL_DIR = $(COPY_DIR) INSTALL_PROGRAM = install -m 755 -p DEL_FILE = rm -f SYMLINK = ln -f -s DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p ####### Output directory OBJECTS_DIR = ./ ####### Files SOURCES = ../source/main.cpp OBJECTS = main.o DIST = /usr/share/qt4/mkspecs/common/g++.conf \ /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/qconfig.pri \ /usr/share/qt4/mkspecs/features/qt_functions.prf \ /usr/share/qt4/mkspecs/features/qt_config.prf \ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/debug.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ /usr/share/qt4/mkspecs/features/static.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ /usr/share/qt4/mkspecs/features/resources.prf \ /usr/share/qt4/mkspecs/features/uic.prf \ /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf \ ../source/CppHelloBoostQtCreatorUbuntuNds.pro QMAKE_TARGET = CppHelloBoostQtCreatorUbuntuNds DESTDIR = TARGET = CppHelloBoostQtCreatorUbuntuNds first: all ####### Implicit rules .SUFFIXES: .o .c .cpp .cc .cxx .C .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" ####### Build rules all: Makefile $(TARGET) $(TARGET): $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: ../source/CppHelloBoostQtCreatorUbuntuNds.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/linux.conf \ /usr/share/qt4/mkspecs/qconfig.pri \ /usr/share/qt4/mkspecs/features/qt_functions.prf \ /usr/share/qt4/mkspecs/features/qt_config.prf \ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ /usr/share/qt4/mkspecs/features/default_pre.prf \ /usr/share/qt4/mkspecs/features/debug.prf \ /usr/share/qt4/mkspecs/features/default_post.prf \ /usr/share/qt4/mkspecs/features/static.prf \ /usr/share/qt4/mkspecs/features/warn_on.prf \ /usr/share/qt4/mkspecs/features/resources.prf \ /usr/share/qt4/mkspecs/features/uic.prf \ /usr/share/qt4/mkspecs/features/yacc.prf \ /usr/share/qt4/mkspecs/features/lex.prf \ /usr/share/qt4/mkspecs/features/include_source_dir.prf $(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ../source/CppHelloBoostQtCreatorUbuntuNds.pro /usr/share/qt4/mkspecs/common/g++.conf: /usr/share/qt4/mkspecs/common/unix.conf: /usr/share/qt4/mkspecs/common/linux.conf: /usr/share/qt4/mkspecs/qconfig.pri: /usr/share/qt4/mkspecs/features/qt_functions.prf: /usr/share/qt4/mkspecs/features/qt_config.prf: /usr/share/qt4/mkspecs/features/exclusive_builds.prf: /usr/share/qt4/mkspecs/features/default_pre.prf: /usr/share/qt4/mkspecs/features/debug.prf: /usr/share/qt4/mkspecs/features/default_post.prf: /usr/share/qt4/mkspecs/features/static.prf: /usr/share/qt4/mkspecs/features/warn_on.prf: /usr/share/qt4/mkspecs/features/resources.prf: /usr/share/qt4/mkspecs/features/uic.prf: /usr/share/qt4/mkspecs/features/yacc.prf: /usr/share/qt4/mkspecs/features/lex.prf: /usr/share/qt4/mkspecs/features/include_source_dir.prf: qmake: FORCE @$(QMAKE) -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile ../source/CppHelloBoostQtCreatorUbuntuNds.pro dist: @$(CHK_DIR_EXISTS) ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0 || $(MKDIR) ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0 $(COPY_FILE) --parents $(SOURCES) $(DIST) ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0/ && (cd `dirname ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0` && $(TAR) CppHelloBoostQtCreatorUbuntuNds1.0.0.tar CppHelloBoostQtCreatorUbuntuNds1.0.0 && $(COMPRESS) CppHelloBoostQtCreatorUbuntuNds1.0.0.tar) && $(MOVE) `dirname ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0`/CppHelloBoostQtCreatorUbuntuNds1.0.0.tar.gz . && $(DEL_FILE) -r ../source/.tmp/CppHelloBoostQtCreatorUbuntuNds1.0.0 clean:compiler_clean -$(DEL_FILE) $(OBJECTS) -$(DEL_FILE) *~ core *.core ####### Sub-libraries distclean: clean -$(DEL_FILE) $(TARGET) -$(DEL_FILE) Makefile compiler_rcc_make_all: compiler_rcc_clean: compiler_uic_make_all: compiler_uic_clean: compiler_image_collection_make_all: qmake_image_collection.cpp compiler_image_collection_clean: -$(DEL_FILE) qmake_image_collection.cpp compiler_yacc_decl_make_all: compiler_yacc_decl_clean: compiler_yacc_impl_make_all: compiler_yacc_impl_clean: compiler_lex_make_all: compiler_lex_clean: compiler_clean: ####### Compile main.o: ../source/main.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../source/main.cpp ####### Install install: FORCE uninstall: FORCE FORCE:
main.cpp
#include <iostream> #include <boost/regex.hpp> #include <nds.h> int main() { //consoleDemoInit is obligatory consoleDemoInit(); std::string s = "Hello World"; s = boost::regex_replace(s,boost::regex("World"),std::string("Boost")); std::cout << s << '\n'; //Infinite waiting while (1) {} }
Process
The project yielded this error in two ways:
- Doing a command-line make
- Running the program from Qt Creator
Hypothesis: arm-eabi (version 4.5.0) cannot compile this Boost library?