Answer the question
In order to leave comments, you need to log in
How to fix an error when compiling C++ code?
This error occurs when building the project. I don't know, I don't know how to fix it.
../deps/source-sdk-2013/mp/src/public/tier1/utlmemory.h:915:2: note: in expansion of macro ‘COMPILE_TIME_ASSERT’
915 | COMPILE_TIME_ASSERT( (nAlignment & (nAlignment-1)) == 0 );
| ^~~~~~~~~~~~~~~~~~~
In file included from ../deps/source-sdk-2013/mp/src/public/mathlib/vector.h:30,
from ../deps/source-sdk-2013/mp/src/public/datamap.h:15,
from ../deps/source-sdk-2013/mp/src/public/tier1/byteswap.h:13,
from ../src/Machinarium/Utils/String.cpp:132:
../deps/cryptopp/cryptlib.h: At global scope:
../deps/cryptopp/cryptlib.h:1200:22: error: expected unqualified-id before ‘const’
1200 | virtual bool Verify(const byte *digest)
| ^~~~~
../deps/source-sdk-2013/mp/src/public/tier0/dbg.h:372:35: note: in definition of macro ‘Verify’
372 | #define Verify( _exp ) (_exp)
| ^~~~
compilation terminated due to -Wfatal-errors.
make[1]: *** [Garrys Mod 10.make:355: obj/Release/Garrys Mod 10/String.o] Error 1
make: *** [Makefile:51: Garrys Mod 10] Error 2
[email protected]:/media/nightmare/2DEDC4C311647F4A/Workspace/cpp.machinarium/projects$ g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 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.
Answer the question
In order to leave comments, you need to log in
Here the Verify macro in dbg.h and the Verify function in cryptlib.h got stuck.
I would prefer to rename one of the two - macro is better - and then sort out where the macro should be and where the function should be.
The developer of the macro is definitely to blame: he called it the simple and common word Verify. The function is somewhere inside the object, and the macro replaces the Verify identifier with all sorts of rubbish, no matter where this identifier is and in what namespace. In addition, it is customary to call such macros something like DBG_VERIFY - unless it is a compatibility macro that replaces, for example, the later nullptr with the old NULL.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question