Jump to content

Error ISO C++17 does not allow 'register' storage class specifier [-Wregister] after gmake gcc12


Go to solution Solved by Gurgarath,

Recommended Posts

Hi have this error when try gmake in the Server source folder :

clang++-devel -Wall -O2 -pipe -mtune=i686 -g -I../include -c utils.c
clang++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
utils.c:341:5: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  341 |     register int tv;
      |     ^~~~~~~~
utils.c:359:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  359 |         register long long tv;
      |         ^~~~~~~~
2 errors generated.
gmake[2]: *** [Makefile:36: utils.o] Error 1
gmake[2]: Leaving directory '/usr/src/Source/Server/libthecore/src'
gmake[1]: *** [Makefile:20: default] Error 2
gmake[1]: Leaving directory '/usr/src/Source/Server/libthecore/src'
gmake: *** [Makefile:44: libthecore] Error 2

this is the makefile of libthecore:

CC = clang++-devel
BIN_DIR = ../lib
BIN = $(BIN_DIR)/libthecore.a
INCLUDE = ../include

GCC_VERSION = $(shell $(CC) --version 2>&1 | grep "(GCC)" | cut -d' ' -f3  | cut -d'.' -f1)

ifeq ($(GCC_VERSION), 4)
CFLAGS = -Wall -O2 -pipe -mtune=i686 -g -I$(INCLUDE)
else
CFLAGS = -Wall -O2 -pipe -mtune=i686 -g -I$(INCLUDE)
endif

LIBS =

OBJFILES = socket.o fdwatch.o buffer.o signal.o log.o utils.o \
        kstbl.o hangul.o heart.o main.o tea.o des.o gost.o memcpy.o

default:
        $(MAKE) $(BIN)

$(BIN): $(OBJFILES)
        if [ ! -d $(BIN_DIR) ]; then mkdir $(BIN_DIR); fi
        ar cru $(BIN) $(OBJFILES) $(LIBS)
        ranlib $(BIN)
        chmod 700 $(BIN)

clean:
        rm -f *.o
        rm -f $(BIN)

dep:
        $(CC) $(CFLAGS) -MM *.c > Depend

$(OBJFILES):
        $(CC) $(CFLAGS) -c $<

memcpy: memcpy.o utils.o log.o
        $(CC) $(CFLAGS) -c -D__MAIN__ memcpy.c
        $(CC) $(CFLAGS) -o memcpy memcpy.o utils.o log.o

include Depend

thats is the version of gcc in the virtualbox machine

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc12/gcc/i386-portbld-freebsd12.4/12.2.0/lto-wrapper
Target: i386-portbld-freebsd12.4
Configured with: /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/configure --disable-multilib --with-build-config=bootstrap-lto-noplugin --disable-nls --enable-gnu-indirect-function --enable-host-shared --enable-plugin --libdir=/usr/local/lib/gcc12 --libexecdir=/usr/local/libexec/gcc12 --program-suffix=12 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc12/include/c++/ --with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --without-zstd --enable-languages=c,c++,objc,fortran,jit --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/share/info/gcc12 --build=i386-portbld-freebsd12.4
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (FreeBSD Ports Collection)

 

 

Sorry for the post but I have already solved the problem, just go to each file cited by the compiler and delete the word register which is deprecated, once this is done the compilation is successful

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.