42_EXAM icon indicating copy to clipboard operation
42_EXAM copied to clipboard

Compilation error ‘warn_unused_result’ [-Wunused-result]

Open TanawatJukmongkol opened this issue 1 month ago • 0 comments

System

OS: NixOS 24.11.20250106.3f0a8ac (Vicuna) x86_64 Kernel: Linux 6.6.69

g++ --version
g++ (GCC) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Error

Oops ! Something went wrong during the compilation...
Please make a report on Github repo, make sure to include this :

      - Your OS: Linux nixos 6.6.69 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan  2 09:32:11 UTC 2025 x86_64 GNU/Linux
      - The error message:
.system/exercise.cpp: In member function ‘int exam::change_ex()’:
.system/exercise.cpp:21:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     system("clear");
      |     ~~~~~~^~~~~~~~~
.system/exercise.cpp: In member function ‘bool exam::prepare_current_ex()’:
.system/exercise.cpp:47:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |     system("mkdir rendu 2> /dev/null");
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
.system/exercise.cpp:48:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   48 |     system("mkdir subjects 2> /dev/null");
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.system/exercise.cpp:49:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   49 |     system("mkdir .system/grading 2> /dev/null");
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.system/exercise.cpp:53:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   53 |     system(cmd_system_call.c_str());
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
.system/exercise.cpp:57:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 |     system(cmd_system_call.c_str());
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Expected result:

Should be compiled

TanawatJukmongkol avatar Jan 13 '25 03:01 TanawatJukmongkol