home › Forums › # Technical Support › Unhandled exception at 0x751a9617 in test.exe
Tagged: fehtiba@gmail.com
- This topic has 20 replies, 5 voices, and was last updated 7 years, 9 months ago by
Juan Rada-Vilela (admin).
-
AuthorPosts
-
July 1, 2014 at 06:16 #1117
Unknown
MemberHi everyone,
I compile fuzzylite with cMake for visual studio 2010 and a small test with codes from this website just failed with warning irst-chance exception at 0x751a9617 in test.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0016cff0..
Unhandled exception at 0x751a9617 in test.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0016cff0..
The program ‘[6100] test.exe: Native’ has exited with code -529697949 (0xe06d7363). Would you please give me some suggestions on possible solutions? Thank you in advance.My test code:
#include <fl/Headers.h> int main(int argc, char** argv){ fl::Engine* engine = new fl::Engine; engine->setName("simple-dimmer"); engine->addHedge(new fl::Any); engine->addHedge(new fl::Extremely); engine->addHedge(new fl::Not); engine->addHedge(new fl::Seldom); engine->addHedge(new fl::Somewhat); engine->addHedge(new fl::Very); fl::InputVariable* inputVariable1 = new fl::InputVariable; inputVariable1->setName("Ambient"); inputVariable1->setRange(0.000, 1.000); inputVariable1->addTerm(new fl::Triangle("DARK", 0.000, 0.250, 0.500)); inputVariable1->addTerm(new fl::Triangle("MEDIUM", 0.250, 0.500, 0.750)); inputVariable1->addTerm(new fl::Triangle("BRIGHT", 0.500, 0.750, 1.000)); engine->addInputVariable(inputVariable1); fl::OutputVariable* outputVariable1 = new fl::OutputVariable; outputVariable1->setName("Power"); outputVariable1->setRange(0.000, 1.000); outputVariable1->setLockOutputRange(false); outputVariable1->setDefaultValue(fl::nan); outputVariable1->setLockValidOutput(false); outputVariable1->setDefuzzifier(new fl::Centroid(200)); outputVariable1->output()->setAccumulation(new fl::Maximum); outputVariable1->addTerm(new fl::Triangle("LOW", 0.000, 0.250, 0.500)); outputVariable1->addTerm(new fl::Triangle("MEDIUM", 0.250, 0.500, 0.750)); outputVariable1->addTerm(new fl::Triangle("HIGH", 0.500, 0.750, 1.000)); engine->addOutputVariable(outputVariable1); fl::RuleBlock* ruleblock1 = new fl::RuleBlock; ruleblock1->setName(""); ruleblock1->setTnorm(new fl::Minimum); ruleblock1->setSnorm(new fl::Maximum); ruleblock1->setActivation(new fl::Minimum); ruleblock1->addRule(fl::FuzzyRule::parse("if Ambient is DARK then Power is HIGH", engine)); ruleblock1->addRule(fl::FuzzyRule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine)); ruleblock1->addRule(fl::FuzzyRule::parse("if Ambient is BRIGHT then Power is LOW", engine)); engine->addRuleBlock(ruleblock1); }
July 1, 2014 at 10:08 #1118Juan Rada-Vilela (admin)
KeymasterHi,
I think the error is caused by issues during compilation.
Have you tried recompiling fuzzylite (clean and build)?
Does running the file fuzzylite.exe work?
Could you please post the commands you are issuing to compile your example?Cheers.
July 2, 2014 at 16:55 #1131Unknown
MemberHello
Thank you for your quick respond.Following are my steps:
a) Download the source code from
b) In the CMake GUI I give fuzzylite source folder as the input folder and select Visual Studio 2010 as the compiler.
in CMake, it does generate the Visual Studio fuzzylite solution without any errors.
Then, I tried to build the Visual Studio solution, but it fails with following errors.4> fl-bin.vcxproj -> C:\Users\Mongolkhuu\Downloads\fuzzylite-3.0-src\Hehe\bin\Debug\fuzzylite-bin-dbg.exe 4> Error copying file (if different) from "C:/Users/Mongolkhuu/Downloads/fuzzylite-3.0-src/fuzzylite-3.0/fuzzylite/lib/fuzzylite-dbg.dll" to "C:/Users/Mongolkhuu/Downloads/fuzzylite-3.0-src/fuzzylite-3.0/fuzzylite/bin". 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "setlocal 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E copy_if_different C:/Users/Mongolkhuu/Downloads/fuzzylite-3.0-src/fuzzylite-3.0/fuzzylite/lib/fuzzylite-dbg.dll C:/Users/Mongolkhuu/Downloads/fuzzylite-3.0-src/fuzzylite-3.0/fuzzylite/bin 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd 4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1. 5>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------ 5> Build all projects ========== Build: 4 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== However, it does generate the fuzzylite-dbg.lib and fuzzylite-dbg.dll files. When i run fuzzylite.exe. its showing following exception
Hello, fuzzylite!
=================
Version 3.0b?
Built on Windows in Debug mode
Floating-point fl::scalar is defined as ‘double’ using 8 bytes
Precision is set to 1e-005
Only 3 decimals are printed
Infinity is printed as: (-inf , inf)
NaN values are printed as: nan
Defuzzifiers by default use 200 divisions
FL_LOG is enabled and prints in console as follows:
[unexpected exception] backtrace:
6: fl::DefuzzifierFactory::DefuzzifierFactory at 0x261640543
5: fl::DefuzzifierFactory::DefuzzifierFactory at 0x261640543
4: terminate at 0x258188448
3: __CxxUnhandledExceptionFilter at 0x2384976
2: UnhandledExceptionFilter at 0x1981426485
1: RtlGetThreadErrorMode at 0x2010143288
0: RtlInitializeExceptionChain at 0x2010035090July 2, 2014 at 18:43 #1132Juan Rada-Vilela (admin)
KeymasterHi,
The error you are getting is quite weird, which makes me think that perhaps you had installed a previous version of fuzzylite in your system and building your solution is performing the linkage to old libraries. For example, I find odd that executing fuzzylite.exe shows version 3.0 when the current version is v4.0.
Could you please make sure you:
- remove any previous version of fuzzylite from your system
- download fuzzylite version 4.0 from http://www.fuzzylite.com/downloads
- build again fuzzylite version 4.0 in your system
Please, let me know if this solves your issues.
July 2, 2014 at 23:16 #1133Unknown
MemberHello,
I compiled fuzzylite solution in VS2010. it fails with following errors.4>LINK : fatal error LNK1104: cannot open file ‘bin\Debug\fuzzylite-dbg.lib’
5>—— Rebuild All started: Project: ALL_BUILD, Configuration: Debug Win32 ——
5> Building Custom Rule C:/Users/Mongolkhuu/Downloads/fuzzylite-4.0.1-source/fuzzylite-4.0/fuzzylite/CMakeLists.txt
5> CMake does not need to re-run because C:\Users\Mongolkhuu\Downloads\fuzzylite-4.0.1-source\fuzzylite-4.0\fuzzylite\dddd\CMakeFiles\generate.stamp is up-to-date.
5> Build all projects
6>—— Skipped Rebuild All: Project: INSTALL, Configuration: Debug Win32 ——
6>Project not selected to build for this solution configuration
========== Rebuild All: 2 succeeded, 3 failed, 1 skipped ==========Then i have changed following part of code as comment in Function.cpp
/* text = “(Temperature is High and Oxigen is Low) or ”
“(Temperature is Low and (Oxigen is Low or Oxigen is High))”;
FL_LOG(f.toPostfix(text));f.variables[“pi”] = 3.14;
text = “-5 *4/sin(-pi/2)”;
FL_LOG(f.toPostfix(text));
try {
FL_LOG(f.parse(text)->evaluate());
} catch (fl::Exception& e) {
FL_LOG(e.getWhat());
}
f.variables[“pi”] = 3.14;
text = “~5 *4/sin(~pi/2)”;
FL_LOG(f.toPostfix(text));
try {
FL_LOG(f.parse(text)->evaluate(&f.variables));
} catch (fl::Exception& e) {
FL_LOG(e.getWhat());
} */then it compiled in VS2010 without any errors. I also tried to run fuzzylite-dbg.exe. It also worked without any exception
here is the output of fuzzylite-dbg.exe:
========================================
fuzzylite: a fuzzy logic control library
version: 4.0b1401
author: Juan Rada-Vilela
========================================
usage: fuzzylite inputfile outputfile
or: fuzzylite [-i] [-if] [-o] [-of] [-ex] [-max] [-sep]where: [-i inputfile]
[-if fll,fis,fcl]
[-o outputfile]
[-of fll,fis,fcl,cpp,java,fld]
[-ex (m)amdani,(t)akagi-sugeno]
[-max maximum]
[-sep separator]Visit http://fuzzylite.com for more information.
after that i tried to use Dll and lib files in Fuzzy_API_Test project.
here is the code:
‘#include <fl/Headers.h>int main(int argc, char** argv){
fl::Engine* engine = new fl::Engine(“simple-dimmer”);
fl::InputVariable* ambient = new fl::InputVariable;
ambient->setName(“Ambient”);
ambient->setRange(0.000, 1.000);
ambient->addTerm(new fl::Triangle(“DARK”, 0.000, 0.500));
ambient->addTerm(new fl::Triangle(“MEDIUM”, 0.250, 0.750));
ambient->addTerm(new fl::Triangle(“BRIGHT”, 0.500, 1.000));
engine->addInputVariable(ambient);fl::OutputVariable* power = new fl::OutputVariable;
power->setName(“Power”);
power->setRange(0.000, 2.000);
power->setDefaultValue(fl::nan);
power->addTerm(new fl::Triangle(“LOW”, 0.000, 1.000));
power->addTerm(new fl::Triangle(“MEDIUM”, 0.500, 1.500));
power->addTerm(new fl::Triangle(“HIGH”, 1.000, 2.000));
engine->addOutputVariable(power);fl::RuleBlock* ruleblock = new fl::RuleBlock;
ruleblock->addRule(fl::Rule::parse(“if Ambient is DARK then Power is HIGH”, engine));
ruleblock->addRule(fl::Rule::parse(“if Ambient is MEDIUM then Power is MEDIUM”, engine));
ruleblock->addRule(fl::Rule::parse(“if Ambient is BRIGHT then Power is LOW”, engine));
engine->addRuleBlock(ruleblock);//No Conjunction or Disjunction is needed
engine->configure(“”, “”, “AlgebraicProduct”, “AlgebraicSum”, “Centroid”);std::string status;
if (!(engine->isReady(&status)))
throw fl::Exception(“Engine not ready. ”
“The following errors were encountered:\n” + status, FL_AT);for (int i = 0; i < 1; ++i){
fl::scalar light = ambient->getMinimum() + i * (ambient->range() / 50);
ambient->setInputValue(light);
std::cout << “light\n”<<fl::Op::str(light);
engine->process();
std::cout << “defuzzify\n”<<fl::Op::str(power->defuzzify());}
}
its showing following error when i add this line ( engine->process(); ) to the mainUnhandled exception at 0x751a9617 in Fuzzy_API_Test.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0014ea60..
when i add this line ( engine->process(); ) to the main,
July 3, 2014 at 08:40 #1134Juan Rada-Vilela (admin)
KeymasterHi,
I managed to create from scratch a Visual Studio C++ Solution using fuzzylite v4.0. I ran into issues mostly because I do not use Visual Studio, but I still managed to successfully run your example. I created an empty project with a single
main.cpp
in which I copied your code. Notice that I build fuzzylite from console and use the library in my empty project. Here are the issues I ran into:- As you mentioned, there is an issue with unreachable code in fuzzylite/Function.cpp, which is solved as you did, or alternatively adding
#pragma warning(disable:4702) //Unreachable code
under the Windows definitions in fl/fuzzylite.h - I had to compile fuzzylite using
cmake . -G"NMake Makefiles" -DFL_DEBUG=ON
to avoiderror LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL'...
. This error refers to the case when fuzzylite is built in release mode, but the VS solution is built in Debug mode. (I did not know how to build the solution in release mode) - I added
fuzzylite-static-dbg.lib
to the linked libraries in the project properties, and I also needed to add thedbghelp.lib
linked library. - In the project properties, in C++ Code Generation, I have
Enable C++ Exceptions: Yes with SEH Exceptions (/EHa)
- I also added the directories:
fuzzylite
andfuzzylite/bin
to include and library in VC++ directories (project properties).
Try the steps mentioned above and let me know if it works now.
July 3, 2014 at 18:21 #1137Unknown
MemberHello
I was adding fuzzylite-dbg.lib before. because when i add fuzzylite-static-dbg.lib, it gives following error.
1> Creating library D:\1_Kinect\Fuzzy_test\Fuzzy_API_Test\Debug\Fuzzy_API_Test.lib and object D:\1_Kinect\Fuzzy_test\Fuzzy_API_Test\Debug\Fuzzy_API_Test.exp
1>fuzzylite-static-dbg.lib(Exception.obj) : error LNK2019: unresolved external symbol __imp__SymFromAddr@20 referenced in function “public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fl::Exception::btCallStack(int)” (?btCallStack@Exception@fl@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>fuzzylite-static-dbg.lib(Exception.obj) : error LNK2019: unresolved external symbol __imp__SymInitialize@12 referenced in function “public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl fl::Exception::btCallStack(int)” (?btCallStack@Exception@fl@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>D:\1_Kinect\Fuzzy_test\Fuzzy_API_Test\Debug\Fuzzy_API_Test.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========When i compile fuzzylite solution, it didnt generate dbghelp.lib in bin\debug folder. i have completed other steps except adding dbghelp.lib.
July 3, 2014 at 18:32 #1138Unknown
MemberHello
If it possible can you share fuzzylite solution’s bin folder (includes lib and dll files) in VS2010 as a zip files on internet.
Thank youJuly 3, 2014 at 18:56 #1139Juan Rada-Vilela (admin)
KeymasterHi,
I got the same error you get with the static library, and all you need to fix it is to add
dbghelp.lib
as a dependency library, the same place where you write fuzzylite-static-dbg.lib.I would prefer to solve the issues publicly by posts such that the solution is available to everyone. If we do not succeed, I will email you the project. I will address these issues in the next version.
July 3, 2014 at 19:55 #1142Unknown
MemberHello,
Thank you for your help and time.
I will be waiting fot the new version of fuzzylite.
and I am looking forward receiving the project from you
my email is: to_bayanaa@jbnu.ac.kr
thank you very much 🙂 -
AuthorPosts
- You must be logged in to reply to this topic.