bakercp / ofxGeographicLib

An openFrameworks wrapper for the Geographic Library.
Other
4 stars 2 forks source link

Compilation failure in VS 2015 Community #1

Open bakercp opened 8 years ago

bakercp commented 8 years ago

Using a slightly patched (by @cffk) version of GeographicLib 1.46, I am attempting to compile the library directly in VS 2015 Community. Since I'm not using the share/static libs, I'm not adding any preprocessor defines (e.g. GEOGRAPHICLIB_SHARED_LIB=0) since I'm not using precompiled libs.

This compiles fine on OSX, Ubuntu (the library source is included directly in the project), but fails with the following errors in VS2015Community.

Severity    Code    Description Project File    Line
Error   C2143   syntax error: missing ';' before '{' (compiling source file src\main.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Constants.hpp  104
Error   C2447   '{': missing function header (old-style formal list?) (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Constants.hpp  104
Error   C2143   syntax error: missing ';' before '{' (compiling source file src\ofApp.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Constants.hpp  104
Error   C2447   '{': missing function header (old-style formal list?) (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Constants.hpp  104
Error   C2146   syntax error: missing ')' before identifier 'x' (compiling source file src\main.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2433   'T': 'inline' not permitted on data declarations (compiling source file src\main.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2365   'T': redefinition; previous definition was 'template parameter' (compiling source file src\main.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2061   syntax error: identifier 'x' (compiling source file src\main.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2059   syntax error: ')' (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2146   syntax error: missing ')' before identifier 'x' (compiling source file src\ofApp.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2433   'T': 'inline' not permitted on data declarations (compiling source file src\ofApp.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2365   'T': redefinition; previous definition was 'template parameter' (compiling source file src\ofApp.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2061   syntax error: identifier 'x' (compiling source file src\ofApp.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2059   syntax error: ')' (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   828
Error   C2334   unexpected token(s) preceding '{'; skipping apparent function body (compiling source file src\main.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   842
Error   C2334   unexpected token(s) preceding '{'; skipping apparent function body (compiling source file src\ofApp.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   842
Error   C2988   unrecognizable template declaration/definition (compiling source file src\main.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2059   syntax error: 'return' (compiling source file src\main.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2238   unexpected token(s) preceding ';' (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2988   unrecognizable template declaration/definition (compiling source file src\ofApp.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2059   syntax error: 'return' (compiling source file src\ofApp.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2238   unexpected token(s) preceding ';' (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   856
Error   C2988   unrecognizable template declaration/definition (compiling source file src\main.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   865
Error   C2143   syntax error: missing ';' before ''template<'' (compiling source file src\main.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   865
Error   C2988   unrecognizable template declaration/definition (compiling source file src\ofApp.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   865
Error   C2143   syntax error: missing ';' before ''template<'' (compiling source file src\ofApp.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   865
Error   C2059   syntax error: '}' (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   918
Error   C2143   syntax error: missing ';' before '}' (compiling source file src\main.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   918
Error   C2059   syntax error: '}' (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   918
Error   C2143   syntax error: missing ';' before '}' (compiling source file src\ofApp.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\Math.hpp   918
Error   C2653   'Constants': is not a class or namespace name (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 405
Error   C3861   'WGS84_a': identifier not found (compiling source file src\main.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 405
Error   C2653   'Constants': is not a class or namespace name (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 405
Error   C3861   'WGS84_a': identifier not found (compiling source file src\ofApp.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 405
Error   C2653   'Constants': is not a class or namespace name (compiling source file src\main.cpp)  example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 414
Error   C3861   'WGS84_f': identifier not found (compiling source file src\main.cpp)    example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 414
Error   C2653   'Constants': is not a class or namespace name (compiling source file src\ofApp.cpp) example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 414
Error   C3861   'WGS84_f': identifier not found (compiling source file src\ofApp.cpp)   example C:\Users\bakercp\Desktop\openFrameworks\addons\ofxGeographicLib\libs\GeographicLib\include\GeographicLib\UTMUPS.hpp 414
cffk commented 8 years ago

Hmm, it seems that this version of Visual Studio is seriously crippled. I can take a look.

cffk commented 8 years ago

I routinely test with Visual Studio 2015 Professional. To test the "community" version I did the following.

Install Visual Studio Community 2015 on a system which does have any VS 2015 installations. Select C++ as a language during installation.

Install cmake version 3.1.1

Run

cmake -G "Visual Studio 14" -A x64 -D GEOGRAPHICLIB_LIB_TYPE=BOTH \
  u:/temp/GeographicLib-1.46
cmake --build . --config Release
cmake --build . --config Release --target RUN_TESTS

This all runs through without errors.

@bakercp I think the ball is in your court now, specifically, to figure out how what you're doing differs from what I did. (It's probably a good idea to verify that the cmake configure + build + test works for you too.)

bakercp commented 8 years ago

Thanks! I imagine it must be preprocessor settings or my project file settings. Will look into it. Thanks!

johanjohan commented 6 years ago

there is an issue in OF 0.9.8 concerning an isnan define in ofMatrix4x4. the VS compilation issue can be solved like this:

before including ofxGeographiclib:


#ifdef isnan // bug: #defined in ofMatrix4x4, rather use std::isnan()...
#undef isnan
#endif
#include "ofxGeographicLib.h"

i ran in this issue multiple times and wonder whether above issue is related