0

I'm trying to build and run an wxWidgets application in CLion under Ubuntu. Following this topic, I could get the feel of the file I need. As I use VSCode, I used the output of the command wx-config --cxxflags to include it to the includePath on c_cpp_properties.json in VSCode.

-I/usr/local/lib/wx/include/gtk3-unicode-3.3 -I/usr/local/include/wx-3.3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

"/usr/local/include/wx-3.3",
"/usr/local/lib/wx/include/gtk3-unicode-3.3"

So, I used this same path for the CLion and using the same skeleton from the topic above and I'm getting a lot of errors:

====================[ Build | FirstC | Debug ]==================================
/snap/clion/203/bin/cmake/linux/bin/cmake --build /home/leandro/Desktop/Biblioteca-Motora/cmake-build-debug --target FirstC -j 9
[1/5] Building CXX object CMakeFiles/FirstC.dir/cDataBase.cpp.o
FAILED: CMakeFiles/FirstC.dir/cDataBase.cpp.o 
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cDataBase.cpp.o -MF CMakeFiles/FirstC.dir/cDataBase.cpp.o.d -o CMakeFiles/FirstC.dir/cDataBase.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cDataBase.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cDataBase.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
   18 | namespace fs = std::filesystem;
      |                     ^~~~~~~~~~
      |                     system
[2/5] Building CXX object CMakeFiles/FirstC.dir/cApp.cpp.o
FAILED: CMakeFiles/FirstC.dir/cApp.cpp.o 
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cApp.cpp.o -MF CMakeFiles/FirstC.dir/cApp.cpp.o.d -o CMakeFiles/FirstC.dir/cApp.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMain.h:14,
                 from /home/leandro/Desktop/Biblioteca-Motora/cApp.h:12,
                 from /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
   18 | namespace fs = std::filesystem;
      |                     ^~~~~~~~~~
      |                     system
In file included from /home/leandro/Desktop/Biblioteca-Motora/cApp.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cApp.h:16:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
   16 | namespace fs = std::filesystem;
      |                     ^~~~~~~~~~
      |                     system
[3/5] Building CXX object CMakeFiles/FirstC.dir/cMotor.cpp.o
FAILED: CMakeFiles/FirstC.dir/cMotor.cpp.o 
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cMotor.cpp.o -MF CMakeFiles/FirstC.dir/cMotor.cpp.o.d -o CMakeFiles/FirstC.dir/cMotor.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
   18 | namespace fs = std::filesystem;
      |                     ^~~~~~~~~~
      |                     system
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘bool cMotor::InsertAndCheck(sqlite3_stmt*, sqlite3*)’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:437:165: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
  437 |         wxMessageDialog dlg = wxMessageDialog(this, _("Motor inserido com sucesso. Dejesa adicionar outro?"), _("Inserção concluída"), wxYES_NO | wxICON_INFORMATION);
      |                                                                                                                                                                     ^
In file included from /usr/local/include/wx-3.3/wx/msgdlg.h:307,
                 from /usr/local/include/wx-3.3/wx/wx.h:66,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:9,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/usr/local/include/wx-3.3/wx/gtk/msgdlg.h:14:24: note: ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’ is implicitly deleted because the default definition would be ill-formed:
   14 | class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
      |                        ^~~~~~~~~~~~~~~
/usr/local/include/wx-3.3/wx/gtk/msgdlg.h:14:24: error: use of deleted function ‘wxMessageDialogBase::wxMessageDialogBase(const wxMessageDialogBase&)’
In file included from /usr/local/include/wx-3.3/wx/wxprec.h:12,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:2,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:1:
/usr/local/include/wx-3.3/wx/msgdlg.h:292:5: note: declared here
  292 |     wxDECLARE_NO_COPY_CLASS(wxMessageDialogBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::EditMotor()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:678:129: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
  678 |                 wxMessageDialog dlg = wxMessageDialog(this, wxString::Format("%s.", sqlite3_errmsg(db)), _("Erro"), wxICON_ERROR);
      |                                                                                                                                 ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:683:126: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
  683 |                 wxMessageDialog dlg = wxMessageDialog(this, _("Motor editado com sucesso."), _("Sucesso"), wxICON_INFORMATION);
      |                                                                                                                              ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::TellErrorOnData()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:695:32: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
  695 |         _("Erro"), wxICON_ERROR);
      |                                ^
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp: In member function ‘void cMotor::TellUnkownError()’:
/home/leandro/Desktop/Biblioteca-Motora/cMotor.cpp:703:32: error: use of deleted function ‘wxMessageDialog::wxMessageDialog(wxMessageDialog&&)’
  703 |         _("Erro"), wxICON_ERROR);
      |                                ^
[4/5] Building CXX object CMakeFiles/FirstC.dir/cMain.cpp.o
FAILED: CMakeFiles/FirstC.dir/cMain.cpp.o 
/usr/bin/c++ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/leandro/Desktop/Biblioteca-Motora/. -I/home/leandro/Desktop/Biblioteca-Motora/sqlite -isystem /usr/local/lib/wx/include/gtk3-unicode-3.3 -isystem /usr/local/include/wx-3.3 -pthread -g -std=gnu++14 -MD -MT CMakeFiles/FirstC.dir/cMain.cpp.o -MF CMakeFiles/FirstC.dir/cMain.cpp.o.d -o CMakeFiles/FirstC.dir/cMain.cpp.o -c /home/leandro/Desktop/Biblioteca-Motora/cMain.cpp
In file included from /home/leandro/Desktop/Biblioteca-Motora/cMotor.h:21,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMain.h:14,
                 from /home/leandro/Desktop/Biblioteca-Motora/cMain.cpp:1:
/home/leandro/Desktop/Biblioteca-Motora/cDataBase.h:18:21: error: ‘filesystem’ is not a namespace-name; did you mean ‘system’?
   18 | namespace fs = std::filesystem;
      |                     ^~~~~~~~~~
      |                     system
/home/leandro/Desktop/Biblioteca-Motora/cMain.cpp: In constructor ‘cMain::cMain(cDataBase*)’:
/home/leandro/Desktop/Biblioteca-Motora/cMain.cpp:30:22: error: ‘fs’ has not been declared
   30 |         log->LogText(fs::current_path().string());
      |                      ^~
ninja: build stopped: subcommand failed.

My CMakeLists.txt is like this:

cmake_minimum_required(VERSION 3.23)
project(Biblioteca_Motora)

set(CMAKE_CXX_STANDARD 14)

include_directories(.)
include_directories(sqlite)
set(wxWidgets_ROOT_DIR /usr/local/include/wx-3.3)
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base std REQUIRED)
include(${wxWidgets_USE_FILE})


set(SOURCE_FILES cApp.cpp cMain.cpp cMotor.cpp cImageViewer.cpp cDataBase.cpp cLog.cpp sqlite/sqlite3.o)
add_executable(FirstC ${SOURCE_FILES})

target_link_libraries(FirstC ${wxWidgets_LIBRARIES})

And for some reason, CLion isn't finding the std::filesystem library... Thank you.

NeoFahrenheit
  • 347
  • 5
  • 16
  • are you building under C++17? What headers did you include? – Igor Aug 11 '22 at 15:30
  • I use the usual headers for wxWidgets and filesystem, vector, iostream... I'm using the most updated version of GCC, I guess. Fresh install of the latest Ubuntu iso – NeoFahrenheit Aug 11 '22 at 16:31
  • do you include ``? And this is available since C++17 - make sure you are building with this turned on - both wxWidgets and your application. However, according to your other question - you don't need it - use `wxStandardPath` class. – Igor Aug 11 '22 at 16:55
  • @Igor Yes, that was the problem. I used C++ 17 and everything was fine. Thank you! – NeoFahrenheit Aug 11 '22 at 19:55

0 Answers0