Closed TimWZH closed 3 years ago
Hi @TimWZH! I have no knowledge about the Microsoft C++ compiler at all. So the code compiles and then it throws this string too long error
when you run it?
I would try to rewrite this line and hope that it works if you do the same thing in a different way. Maybe try:
const std::string info = std::string("constructing FastForest from ") + txtpath + std::string(": ");
If you find a way to create the same info
string that works on Visual studio, I'd be happy about a pull request!
If it doesn't work, you can also leave the info string empty in your fastforest build, it's only used for error messages anyway:
const std::string info;
Let me know if any of the solutions work!
Cheers, Jonas
Hi Jonas,
I find that it is likely that load_txt function does not receive correct parameters.
When I try to pass parameter
std::vector<std::string> features{ "f0", "f1", "f2", "f3", "f4" };
I got this when debugging:
And this for txtpath:
But it is okay when I try these code :
#include <iostream>
#include <cmath>
#include <iostream>
#include <vector>
void test(std::string const& txtpath, std::vector<std::string>& fea) {
const std::string info = "constructing FastForest from " + txtpath + ": ";
}
int main()
{
std::vector<std::string> features{ "f0", "f1", "f2", "f3", "f4" };
test("model.txt",features);
return 0;
}
Do you know why?
Thanks, Tim
Hi Tim, sorry for the late reply! What happens here is quite strange.
The messages about variables being optimized away reminds me that it could be an optimization issue. Have you tried to compile fastforest without the optimization flag? You can do that just by removing the -O2
in this line in CMakeLists.txt.
Hi Jonas,
Thanks for your help! I realized that I added additional optimization commands when compiling. So now I use your original CmakeLists.txt and it works!
Hi,
I got std::length_error when I was trying to build and run example codes on windows visual studio 2017. I have no idea what is wrong here. Could you help me with it?
Thanks,
Building information: