grt
grt copied to clipboard
Issues building in Visual Studio 2010
Hi!
I´m trying to build GRT on Visual Studio 2010, and have encountered a few issues (I just copied the entire sourcecode to my Openframeworks 0074 application).
1- Everywhere where it says " std::isinf" or " std::isnan" throws an error. Deliting the "std::" namespace from the instruction seems to resolve the issue.
2- In the declaration of "bool MLBase::MLBase::map(VectorDouble inputVector){ return map_( inputVector ); }" in the MLBase.cpp file, there´s that repeated "MLBase::".
3- I´m getting an ambiguous call to an overload function on "const UINT numBatches = (UINT)ceil( numTrainingSamples/batchSize );" at line 171 on BernoulliRBM.cpp .
None of the overloads returns an unsigned integer, but they do return:
long double ceil(long double) float ceil(float) double ceil(double)
Don´t know which one is intended to use here
3- On Visual Studio 2012 the ambiguous call error does not occur.
Hi,
Thanks for flagging these build issues on Windows.
I fixed issue [3] in the latest commit, this was the result of the compiler not casting the numTrainingSamples/batchSize to a floating point value.
As for issue [2], I looked at the code in MLBase for both map functions and my copy of the code does not contain a double declaration. Is this on line 112? If so, this is what I have on line 112:
bool MLBase::map(VectorDouble inputVector){ return map_( inputVector ); }
For issue [1], this is an annoying issue with Windows compilers vs gcc, g++ or clang. I'm going to search the web for a solid fix for this, that will also work on Linux and OS X.
I just merged a pull request from romain guillemot which features a large number of fixes for Windows.
These fixes are now merged into the main branch, I've tested this on OS X (10.9) and Linux (Ubuntu 14.04), could you check to see if these fixes also resolve the 'std::isinf' errors you were coming up against on Windows?
Thanks,
- Nick
But for Linux, it thrown the error:
../../GRT/CoreAlgorithms/ParticleFilter/ParticleFilter.h error: call of overloaded ‘isnan(double&)’ is ambiguous
uname -a
Linux archlinux 3.16.2-1-ARCH #1 SMP PREEMPT Sat Sep 6 13:12:51 CEST 2014 x86_64 GNU/Linux
gcc version 4.9.1 20140903 (prerelease) (GCC)
Then, does it need to use
#ifdef WIN32
...
#else
...
#endif
for different platform porting?
1 and 3 - I don't get any more build errors on Visual Studio 2010 after your last commit.
2- Yes, it was on line 112. I double checked the repeated "MLBase::" on the ZIP I downloaded yesterday from this repo, and it´s there.
Now I just did a git clone, and the instruction is fine... so no worries.
Thanks for the quick response! Cheers!
Hi Leslie,
On archlinux, is it just the isnan in the ParticleFilter that is causing issues, or are you getting lots of other isnan errors across the toolkit?
If so, then I will need to add a custom isnan and isinf function that adapts based on the OS being used.
Hi nick,
getting lots of other isnan errors across the toolkit, so perhaps it is better to wrapper the std::isnan to GRT::isnan for different platform porting ;)
Regards, Leslie Zhai
I've created a custom grt_isinf and grt_isnan macro which will change depending on the actual OS being used. Hopefully this will fix the various issues people are coming up against when using different OS versions.
These can be found in the Util/GRTTypedefs.h header.
Can you all pull the current version of the toolkit and see if this now works on Windows and Arch Linux (I've tested this myself on OS X and Ubuntu, and things are working for me).
Thanks,
- Nick
Hi Nick,
There is still some source code forgot to change to grt_isnan, for example, https://github.com/nickgillian/grt/blob/master/GRT/CoreAlgorithms/ParticleFilter/ParticleFilter.h#L634
Regards, Leslie Zhai
Same on VS2010 (isnan invocations).
dtw.cpp line 680 knn.cpp line 284 knn.cpp line 288 particlefilter.h line 569 particlefilter.h line 589 particlefilter.h line 614 particlefilter.h line 634
Thanks for flagging the marco updates I missed, I just merged Leslie's updates which fixed all these files and things are building OK on my OS X (10.9) and Linux (Ubuntu 14.04) machines.
Hopefully this will also resolve the issues for you on Windows!
Hay there, i tried building on windows vs2013 and got the following error in libsvm:
error C4996: 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
Is this a known bug?
defining _CRT_SECURE_NO_WARNINGS just produces other errors. I havn't tested, but perhaps upgrading to version 319 would resolve the problem? If I find some time, I'll try tonight. Best Regards, Lukas
could solve this problem by defining
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_DEPRECATE
in libsvm.h
Thanks for flagging this, I'll fix this now.
Hey i tried building on windows vs2013 and got the following error error c2065:'func':undeclared identifier
could u please help me in figuring out the problem
@sushilkh: Fixed in a recent pull request, https://github.com/nickgillian/grt/pull/55 .