Pergunta

Has anyone done this before ? I am not able to get it to work. Following are my steps:

  1. Download the windows package from link
  2. I can run qfuzzylite (gui-tool) without any problem. Now I want to use the fuzzylite lib in my Visual Studio + Qt Integration Project.
  3. In the CMake GUI I give fuzzylite source folder as the input folder and select Visual Studio 2010 as the compiler.
  4. I am able to generate the Visual Studio fuzzylite solution in CMake without any errors.
  5. Then, I tried to build the Visual Studio solution, but it fails with some weird errors. However, it does generate the fuzzylite-dbg.lib file (which I need).
  6. Then I use this lib file and the fuzzylite.dll and include the path to the Headers in the VS Project. The project builds without any errors.
  7. Now in the code I am doing

    fl::Engine* engine = new fl::Engine("simple-dimmer");

This fails with the following exception:

exception text: bad allocation
exception type: class std::bad_alloc
Foi útil?

Solução 2

Ok, got it :)

Here are the steps for future reference:

  1. Download the windows package from link
  2. In the CMake GUI I give fuzzylite source folder as the input folder and select Visual Studio 2010 as the compiler. Now, if you want to use the lib in Debug mode tick the FL_DEBUG box (this is where I went wrong)
  3. Now on clicking "generate", it will generate 5 projects:
    • ALL_BUILD
    • fl-bin
    • fl-shared
    • fl-static
    • INSTALL
    • ZERO_CHECK

Now in the Project properties in fl-bin, shared and static go to the Project Properties. In C/C++ go to Preprocessor get rid of the space in FL_DATA="mm.dd.yyyy " to "mm.dd.yyyy" (weird). The solution should build fine and will generate fuzzylite-dbg.dll and fuzzylite-dbg.lib in the lib folder.

Use these files in your VC Project by adding the fuzzy-dbg.lib as the linker input and place the dll in the solution folder. Give the path "path\to\fuzzylite\fuzzylite." to the Include Directories.

Do the same process for Release mode (don't tick the FL_DEBUG flag)

Outras dicas

Thank you for your detailed steps, but the solution seems to be a bit random (or weird as you put it). Unless more information is provided about the error, I strongly discourage the use of such a solution to attempt any fix to fuzzylite.

If you are running into problems, I strongly encourage you to report the problem in the forums at http://www.fuzzylite.com, where I and others will be very happy to help you.

As for the compiling errors, fuzzylite treats warnings as errors. A warning that is being raised in fuzzylite 4.0 when compiled using Visual Studio (not from console via nmake), and potentially in previous versions, is warning C4702, which refers to unreachable code. You can fix this by adding in file fl/fuzzylite.h the following line within the #ifdef FL_WINDOWS (together other #pragmas):

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

If the library was not built correctly, errors are bound to happen during runtime.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top