home Forums Search Search Results for 'visual studio'

Viewing 5 results - 61 through 65 (of 65 total)
  • Author
    Search Results
  • Unknown
    Member

    Hi everyone,

    I compile fuzzylite with cMake for visual studio 2010 and a small test with codes from this website just failed with warning ‘Unhandled exception at 0x76212c1a in FuzzyLiteTest.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0030e718..’ at line “engine->process();” as in the program below. Would you please give me some suggestions on possible solutions? Thank you in advance.

    My test code:

    #include "stdafx.h"
    #include "fl/Headers.h"
    
    using namespace fl;
    
    int main(){
    
    	fl::Engine* engine = new fl::Engine;
    	engine->setName("simple-dimmer");
    
    	fl::InputVariable* Ambient = new fl::InputVariable;
    	Ambient->setEnabled(true);
    	Ambient->setName("Ambient");
    	Ambient->setRange(0.000, 1.000);
    	Ambient->addTerm(new fl::Triangle("DARK", 0.000, 0.250, 0.500));
    	Ambient->addTerm(new fl::Triangle("MEDIUM", 0.250, 0.500, 0.750));
    	Ambient->addTerm(new fl::Triangle("BRIGHT", 0.500, 0.750, 1.000));
    	engine->addInputVariable(Ambient);
    
    	fl::OutputVariable* Power = new fl::OutputVariable;
    	Power->setEnabled(true);
    	Power->setName("Power");
    	Power->setRange(0.000, 1.000);
    	Power->fuzzyOutput()->setAccumulation(new fl::Maximum);
    	Power->setDefuzzifier(new fl::Centroid(200));
    	Power->setDefaultValue(fl::nan);
    	Power->setLockValidOutput(false);
    	Power->setLockOutputRange(false);
    	Power->addTerm(new fl::Triangle("LOW", 0.000, 0.250, 0.500));
    	Power->addTerm(new fl::Triangle("MEDIUM", 0.250, 0.500, 0.750));
    	Power->addTerm(new fl::Triangle("HIGH", 0.500, 0.750, 1.000));
    	engine->addOutputVariable(Power);
    
    	fl::RuleBlock* ruleBlock = new fl::RuleBlock;
    	ruleBlock->setEnabled(true);
    	ruleBlock->setName("");
    	ruleBlock->setConjunction(NULL);
    	ruleBlock->setDisjunction(NULL);
    	ruleBlock->setActivation(new fl::Minimum);
    	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);
    
    	std::string status;
    	if (! engine->isReady(&status))
    		throw fl::Exception("Engine not ready. "
    		"The following errors were encountered:\n" + status, FL_AT);
    
    	fl::scalar light = Ambient->getMinimum() + 2 * (Ambient->range() / 50);
    	Ambient->setInputValue(light);
    	engine->process();
    
    }
    #1039
    Unknown
    Member

    As far as I know, dlls can be compiled with debug/symbol information, or without it. In the first case, it is possible to create a library only from the dll file, that a compiler can use in later projects. For example mingw has its /lib subdirectory containing the libraries in order to resolve external references. These *.a files can be generated using the dll file, some grepping and a program like dlltool.

    In the downloadable windows package I only found a fuzzylite.dll file that seems to be stripped. A stripped dll has no extra symbol info so *.a libraries used by mingw could not be reconstructed. The missing libfuzzylite.a file led to “unresolved reference” errors when I tried to compile my working project in CodeBlocks-MinGW.

    After the compilation of the fuzzylite cmake project with mingw, I got the following binaries:

    _fuzzylite.dll.a
    fuzzylite.exe
    libfuzzylite.dll
    libfuzzylite.dll.a
    libfuzzylite-static.a

    After I give this directory to mingw, it no longer reports unresolved refs. An example mingw shell command as follows:

    mingw32-g++.exe -Wall -g -IC:\fuzzylite40\sources\fuzzylite -c E:\work\fuzzytest\fuzzytest.cpp -o obj\fuzzytest.o
    mingw32-g++.exe -LC:\fuzzylite40\bpbuild -o bin\fuzzytest.exe obj\fuzzytest.o -lfuzzylite

    …where C:\fuzzylite40\sources\fuzzylite is the include dir containing the required *.cpp headers and classes for development, and C:\fuzzylite40\bpbuild is the dir containing the binaries mentioned above. However, I guess only the libfuzzylite.dll.a is only needed in this example, and of course, the fuzzylite.dll for running the executable.

    Unfortunately I don’t have much experience with dll compilation, so I can’t advise how to make a non-stripped dll with full debug info. I guess most IDEs offer it somewhere without us needing to know the command-line syntax. That would be easier if you created some /binaries subdirectory and further subdirs containing linux .so, mingw .a or visual studio libs (whatever they named in case of that).

    Keep up the good work.

    #959

    Hi,

    I think the best option you have is to configure MPLab looking at the configuration of a well-configured IDE. I am guessing you need to add the path to the C++/STL headers in the INCLUDE_PATH and the path to the C++ libraries in the LIBRARY_PATH. Please, look in your filesystem where the header is located and add its path to the INCLUDE_PATH. Once it compiles most of the files, it will probably fail at link time due to the missing libraries, for which you will need to find out which are those libraries and add them to the project as -llibrary-name (e.g. -lfuzzylite). I think my best suggestion is to first configure a simple project to work with fuzzylite using a regular IDE (Netbeans, Eclipse, XCode or Visual Studio), and once you are able to build and run an example, explore the necessary configuration of the IDE to make it work in MPLab.

    Once you manage to make it work, we would all appreciate if you could put detailed information about configuring MPLab to run fuzzylite.

    Cheers.

    #950

    Hi Manishak,

    Thank you for your email reporting the issue.

    I have tried to “Build Solution” in Visual Studio 2010 and I was not able to compile either. The problem is that a warning is raised during compile time and warnings are treated as errors in order to have clean builds. The warning code is C4702, which happens due to unreachable code (e.g. code after a return statement) that I use for tests.

    Please, add in file fl/fuzzylite.h the following line within the #ifdef FL_WINDOWS (together with the other #pragmas):

    #pragma warning(disable:4702) //Ignore unreachable code

    I was able to compile after this.

    Please, let me know if this solves your issue.

    Cheers.

    #949
    Unknown
    Member

    Hi All,

    I want use fuzzylite in VS 2012 on Win7 OS. I followed the same step as given in below link :
    http://stackoverflow.com/questions/17339500/using-fuzzylite-in-visual-studio-2010

    but it gives error. Error – ” No object file generated”

    Using Cmake to compile source code of fuzzylite, it generates sln files properly. But after compiling the solution it gives error. Please help.

    Thanks

Viewing 5 results - 61 through 65 (of 65 total)