grt icon indicating copy to clipboard operation
grt copied to clipboard

Issues building in Visual Studio 2010

Open tenderbolton opened this issue 9 years ago • 16 comments

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

tenderbolton avatar Sep 25 '14 18:09 tenderbolton

3- On Visual Studio 2012 the ambiguous call error does not occur.

tenderbolton avatar Sep 25 '14 18:09 tenderbolton

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.

nickgillian avatar Sep 25 '14 20:09 nickgillian

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

nickgillian avatar Sep 25 '14 21:09 nickgillian

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?

xiangzhai avatar Sep 26 '14 01:09 xiangzhai

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!

tenderbolton avatar Sep 26 '14 16:09 tenderbolton

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.

nickgillian avatar Sep 27 '14 12:09 nickgillian

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

xiangzhai avatar Sep 28 '14 01:09 xiangzhai

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

nickgillian avatar Sep 28 '14 19:09 nickgillian

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

xiangzhai avatar Sep 29 '14 01:09 xiangzhai

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

tenderbolton avatar Sep 29 '14 13:09 tenderbolton

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!

nickgillian avatar Oct 02 '14 20:10 nickgillian

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

sakulstra avatar Oct 30 '14 15:10 sakulstra

could solve this problem by defining

#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_DEPRECATE

in libsvm.h

sakulstra avatar Oct 30 '14 19:10 sakulstra

Thanks for flagging this, I'll fix this now.

nickgillian avatar Oct 30 '14 19:10 nickgillian

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 avatar Mar 30 '16 11:03 sushilkh

@sushilkh: Fixed in a recent pull request, https://github.com/nickgillian/grt/pull/55 .

ulatekh avatar Apr 21 '16 17:04 ulatekh