Home > Mobile >  I am facing the error in cryptolib.h file which is part of crypto library
I am facing the error in cryptolib.h file which is part of crypto library

Time:02-11

I have used the crypto library in my project. when i am trying to build the solution then visual studio is give me this below errors for the cryptolib.h file. also i have add the screenshot of error.

> Build started...
> 
> 1>------ Build started: Project: SharedObject1, Configuration: Debug
> ARM ------ 1>ANDROID_HOME=C:\\Microsoft\AndroidSDK\25
> 1>ANT_HOME=C:\Program Files (x86)\Microsoft Visual
> Studio\2019\Community\Apps\apache-ant-1.9.3 1>JAVA_HOME=C:\Program
> Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25
> 1>NDK_ROOT=C:\\Microsoft\AndroidNDK64\android-ndk-r16b
> 1>cryptpp_decrypt.cpp 1>In file included from cryptpp_decrypt.cpp:5:
> 1>./cryptopp/cryptlib.h(359,47): error : cannot use typeid with
> -fno-rtti 1>                return GetValue((std::string("ThisObject:") typeid(T).name()).c_str(),
> object); 1>                                                           
> ^ 1>./cryptopp/cryptlib.h(368,50): error : cannot use typeid with
> -fno-rtti 1>                return GetValue((std::string("ThisPointer:")   typeid(T).name()).c_str(),
> ptr); 1>                                                              
> ^ 1>./cryptopp/cryptlib.h(381,29): error : cannot use typeid with
> -fno-rtti 1>                return GetVoidValue(name, typeid(T), &value); 1>                                          ^
> 1>./cryptopp/cryptlib.h(455,30): error : cannot use 'throw' with
> exceptions disabled 1>                {if (stored != retrieving) throw
> ValueTypeMismatch(name, stored, retrieving);} 1>                      
> ^ 1>./cryptopp/cryptlib.h(471,4): error : cannot use 'throw' with
> exceptions disabled 1>                        throw
> InvalidArgument(std::string(className)   ": missing required parameter
> '"   name   "'"); 1>                        ^
> 1>./cryptopp/cryptlib.h(486,4): error : cannot use 'throw' with
> exceptions disabled 1>                        throw
> InvalidArgument(std::string(className)   ": missing required parameter
> '"   name   "'"); 1>                        ^
> 1>./cryptopp/cryptlib.h(594,35): error : cannot use 'throw' with
> exceptions disabled 1>        virtual Clonable* Clone() const {throw
> NotImplemented("Clone() is not implemented yet.");}      // TODO: make
> this =0 1>                                         ^
> 1>./cryptopp/cryptlib.h(762,4): error : cannot use 'throw' with
> exceptions disabled 1>                {throw
> NotImplemented(GetAlgorithm().AlgorithmName()   ": this object doesn't
> support resynchronization");} 1>                 ^
> 1>./cryptopp/cryptlib.h(785,3): error : cannot use 'throw' with
> exceptions disabled 1>                throw
> NotImplemented(GetAlgorithm().AlgorithmName()   ": this object doesn't
> support resynchronization"); 1>                ^
> 1>./cryptopp/cryptlib.h(1090,3): error : cannot use 'throw' with
> exceptions disabled 1>                throw
> NotImplemented("StreamTransformation: this object doesn't support
> random access"); 1>                ^ 1>./cryptopp/cryptlib.h(1450,3):
> error : cannot use 'throw' with exceptions disabled 1>               
> throw NotImplemented("RandomNumberGenerator: IncorporateEntropy not
> implemented"); 1>                ^ 1>./cryptopp/cryptlib.h(1818,4):
> error : cannot use 'throw' with exceptions disabled 1>                
> throw NotImplemented("BufferedTransformation: this object can't be
> reinitialized"); 1>                        ^
> 1>./cryptopp/cryptlib.h(2358,4): error : cannot use 'throw' with
> exceptions disabled 1>                        throw
> NotImplemented("BufferedTransformation: this object is not
> attachable"); 1>                        ^
> 1>./cryptopp/cryptlib.h(2428,31): error : cannot use 'throw' with
> exceptions disabled 1>                {if (!Validate(rng, level))
> throw InvalidMaterial("CryptoMaterial: this object contains invalid
> values");} 1>                                            ^
> 1>./cryptopp/cryptlib.h(2440,25): error : cannot use 'throw' with
> exceptions disabled 1>                {CRYPTOPP_UNUSED(bt); throw
> NotImplemented("CryptoMaterial: this object does not support
> saving");} 1>                                      ^
> 1>./cryptopp/cryptlib.h(2457,25): error : cannot use 'throw' with
> exceptions disabled 1>                {CRYPTOPP_UNUSED(bt); throw
> NotImplemented("CryptoMaterial: this object does not support
> loading");} 1>                                      ^
> 1>./cryptopp/cryptlib.h(2474,3): error : cannot use 'throw' with
> exceptions disabled 1>                throw
> NotImplemented("CryptoMaterial: this object does not support
> precomputation"); 1>                ^
> 1>./cryptopp/cryptlib.h(2482,87): error : cannot use 'throw' with
> exceptions disabled 1>               
> {CRYPTOPP_UNUSED(storedPrecomputation);
> CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw
> NotImplemented("CryptoMaterial: this object does not support
> precomputation");} 1>                                                 
> ^ 1>./cryptopp/cryptlib.h(2489,87): error : cannot use 'throw' with
> exceptions disabled 1>               
> {CRYPTOPP_UNUSED(storedPrecomputation);
> CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw
> NotImplemented("CryptoMaterial: this object does not support
> precomputation");} 1>                                                 
> ^ 1>CLANGCOMPILE : fatal error : too many errors emitted, stopping now
> [-ferror-limit=] 1>20 errors generated. 1>Done building project
> "SharedObject1.vcxproj" -- FAILED.
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

enter image description here

please help if anybody know how can i solve this error?

CodePudding user response:

I have solved this error.

First go to your solution explorer in visual studio.

then right click on the project.

then go to your project properties.

your_project>properties>C/C >Code Generation>Enable C Exceptions> then changed to Yes

after that

your_project>properties>C/C >Language>Enable Run-Time Type Information then changed to Yes

then clean solution and again build the solution.

  • Related