class QList<QString> has no member named 'emplace_back'
- 
Hello, 
 I'm getting this problem
 class QList<QString> has no member named 'emplace_back'for code 
 QList<QString> list;
 list.emplace_back("string");Other members like append and such seem to work as intended. There is no emplaceBack() either however. Any help is much appreciated! QTVersion: 6.8.2 
 QTCreator: 15.0.1I made sure that I have QT6 by appending QStringView to a QString and it worked fine. All my kits have 6.8.2. Pressing F2 to go the header file shows that there is no emplace anything in there. 
- 
Hello, 
 I'm getting this problem
 class QList<QString> has no member named 'emplace_back'for code 
 QList<QString> list;
 list.emplace_back("string");Other members like append and such seem to work as intended. There is no emplaceBack() either however. Any help is much appreciated! QTVersion: 6.8.2 
 QTCreator: 15.0.1I made sure that I have QT6 by appending QStringView to a QString and it worked fine. All my kits have 6.8.2. Pressing F2 to go the header file shows that there is no emplace anything in there. @mortem said in class QList<QString> has no member named 'emplace_back': There is no emplaceBack() either however template <typename... Args> QList<T>::reference QList::emplaceBack(Args &&... args) Are you saying that does not compile? 
- 
Hi, It looks like there's something off with your sources. The methods have been available since 5.15 and the current dev branch has them as well. 
- 
Ok I fixed it somehow in CMakeLists. CMakeLists.txt had find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)- I removed Qt5 from there
- set(PROJECT_SOURCES did NOT have the files I had added while building the program. They were being added later in the else-clause in cmake logic so I added the missing ones to PROJECT_SOURCES. The code below was the situation before the fix
 set(PROJECT_SOURCES main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(Gridlink MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET Gridlink APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation else() if(ANDROID) add_library(Gridlink SHARED ${PROJECT_SOURCES} ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") else() add_executable(Gridlink ${PROJECT_SOURCES} searchview.h searchview.cpp searchview.ui mpd_communication.h mpd_communication.cpp libraryview.h libraryview.cpp libraryview.ui artistview.h artistview.cpp artistview.ui albumview.h albumview.cpp albumview.ui datahandler.h datahandler.cpp config.h config.cpp song.h song.cpp album.h album.cpp ) endif() endif()
- 
M mortem has marked this topic as solved on
 
