Closed gabrielgcma closed 1 year ago
That's a bit odd. Some thoughts to experiment:
const string
and print it before passing it to the method. Also print c_str(). If nothing works, create a simple file where you try using the same tools in FuzzyLite to open the file and debug it to see why the file cannot be opened.
Let me know if any works. Cheers.
That's a bit odd. Some thoughts to experiment:
- Delete the path and write it again manually. Just thinking of a null character passed inadvertently before "C:" and hence the empty path.
- Try putting the fis file where you are running your code so instead of a full path you just have "rules.fis". Thinking of issues escaping path separators.
- Make sure the file exists and you can edit it with your text editor. Thinking of a different reason why the file could not be opened.
- Long shot, set the file path to
const string
and print it before passing it to the method. Also print c_str().If nothing works, create a simple file where you try using the same tools in FuzzyLite to open the file and debug it to see why the file cannot be opened.
Let me know if any works. Cheers.
Thanks for replying! Also (as I forgot to say earlier), amazing library!
Did step 1, nothing. I'm able to read the file's content using std::fstream
and it's working properly.
Did step 2, now it's not even catching the exception, it's just throwing this again and again:
It's curious, given that I can access the file's content just fine using std::fstream
Step 3: it exists and I can open it.
Step 4: Using const
did not work. Printing before the method prints the right path. Printing filePath.c_str()
also prints the right path.
If nothing works, create a simple file where you try using the same tools in FuzzyLite to open the file and debug it to see why the file cannot be opened.
I tried saving a simple ftest.cpp
file and doing this inside Developer Powershell for VS :
cl.exe ftest.cpp fuzzylite-static.lib C:\fuzzylite-6.0-Win64\fuzzylite-6.0\fuzzylite\release\bin\fuzzylite.lib /EHsc /MD
but got:
ftest.cpp
ftest.cpp(2): fatal error C1083: Cannot open include file: 'fl/Headers.h': No such file or directory
Thanks for your kind words.
Did you compile the library? Maybe the issue is in the compiled libraries and your version of C++ libraries. If you have not compiled the libraries, please do so following instructions from GitHub. I built those libraries about 6 years ago.
Prior to your reply I had not compiled the library, so I followed the instructions and ran build.bat
for both release and debug builds, but I'm still getting the same error when running that simple file:
cl.exe ftest.cpp fuzzylite-static.lib C:\fuzzylite-6.0-Win64\fuzzylite-6.0\fuzzylite\release\bin\fuzzylite.lib /EHsc /MD
ftest.cpp
ftest.cpp(2): fatal error C1083: Cannot open include file: 'fl/Headers.h': No such file or directory
I get the sense that I'm doing something very wrong so I'm grateful for the patience anyways.
EDIT: sorry for the slowness, I didn't realize the source code wasn't in the same folder as the fl
folder (which is the fuzzylite
folder). I managed to make it work and it is compiling just fine using:
cl.exe ftest.cpp C:\fuzzylite-6.0-Win64\fuzzylite-6.0\fuzzylite\release\bin\fuzzylite-static.lib /EHsc /MD
Now I just need to figure out how to make it work in Visual Studio. Thanks.
Nice. Well done.
You can find more information about setting up a project using CMake here: https://github.com/fuzzylite/fuzzylite/tree/release/examples/application
You could probably copy the application CMake file, adapt it to your needs, and then export the cmake project to Visual Studio.
Although perhaps simpler would be to manually configure:
I'm trying to import a .fis file:
Which is outputting to the console:
Line 31 from
Importer.cpp
checks whether or not the reader is open:So it seems the file path is blank when it's passed to the reader at line 29:
I'm currently using Visual Studio Community 2022 17.5.0 with Visual C++ 2022, on Windows 11.