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 codeunder the Windows definitions in fl/fuzzylite.h
- I had to compile fuzzylite using
cmake . -G"NMake Makefiles" -DFL_DEBUG=ONto avoid
error 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.libto the linked libraries in the project properties, and I also needed to add the
- In the project properties, in C++ Code Generation, I have
Enable C++ Exceptions: Yes with SEH Exceptions (/EHa)
- I also added the directories:
fuzzylite/binto include and library in VC++ directories (project properties).
Try the steps mentioned above and let me know if it works now.