nappgui_src icon indicating copy to clipboard operation
nappgui_src copied to clipboard

How to effectively change the compiler standard from c90 to c99

Open jackybek opened this issue 7 months ago • 2 comments

I followed the instructions under TUTORIAL->USER GUIDE->Create new application. In para 6, it states that i can change the compiler standards from c90 (default) to c99 by adding 2 additional lines in hello/CMakeLists.txt.

This is my updated CMakeLists.txt in ~/nappgui_src/jacky/hello/

nap_desktop_app(nappmain "" NRC_NONE) #----- nap_target_c_standard(nappmain 99) nap_target_cxx_standard(nappmain 14) #-----

After making the above changes, i then do the following:

  1. run : ~/nappgui_src/jacky/sudo cmake -S . -B build
  2. run : ~/nappgui_src/jacky/sudo cmake --build build

But I still get a lot of warnings relating to C90 e.g. /home/pi/nappgui_src/jacky/hello/link_files/open62541.c:101770:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

Please advise how I can go above resolving these warnings.

jackybek avatar Apr 28 '25 09:04 jackybek

Hi @jackybek. Try to remove the build folder an run cmake -S . -B build again. If doesn't work, please provide more context info: Operating system, compiler version, etc

frang75 avatar Apr 29 '25 17:04 frang75

i renamed the original build directory and run the following commands:

sudo cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-g2" -DCMAKE_CXX_FLAGS="-g2" -DCMAKE_INSTALL_PREFIX=/usr/local/nappgui --fresh

sudo cmake --build build --clean-first

I still get the c90 warnings.

My compiler is cc (Debian 12.2.0-14) 12.2.0

My OS is Linux OPCClient-20 6.12.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) aarch64 GNU/Linux

On Wed, 30 Apr 2025 at 01:23, Francisco García Collado < @.***> wrote:

frang75 left a comment (frang75/nappgui_src#207) https://github.com/frang75/nappgui_src/issues/207#issuecomment-2839656649

Hi @jackybek https://github.com/jackybek. Try to remove the build folder an run cmake -S . -B build again. If doesn't work, please provide more context info: Operating system, compiler version, etc

— Reply to this email directly, view it on GitHub https://github.com/frang75/nappgui_src/issues/207#issuecomment-2839656649, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMXJIBURAP3VBVZDUWA4FD236YRBAVCNFSM6AAAAAB374O4FSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMZZGY2TMNRUHE . You are receiving this because you were mentioned.Message ID: @.***>

jackybek avatar Apr 30 '25 01:04 jackybek