mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
828 stars 254 forks source link

GeoJSONSource missing (Use of undeclared type 'GeoJSONSource') #1049

Closed jerzykiler closed 6 years ago

jerzykiler commented 6 years ago

Hello,

I am trying to complete the Styled GeoJSON tutorial from the main page and when I declare a GeoJSONSource type variable I get an error:

    var landUseSource: GeoJSONSource?        // ! Use of undeclared type 'GeoJSONSource'

I have set up the HelloEarth project with binary distribution.

Should I do something more to get the GeoJSONSource type visible or am I doing something wrong ?

Cheers

mousebird commented 6 years ago

It looks like GeoJSONSource is under vector_tiles now and won't appear in the binary version. Best to set things up with a submodule for now.

jerzykiler commented 6 years ago

I have wired up everything from sources now and added

#import "vector_tiles/GeoJSONSource.h"

to MaplyBridge.h

and now the build fails with the information 'MaplyComponent.h' file not found in GeoJSONSource.h file

#import "MaplyComponent.h"    // 'MaplyComponent.h' file not found
jerzykiler commented 6 years ago

Ok i fixed that with: #import "../MaplyComponent.h"

but now

it fails with:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GeoJSONSource", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
jerzykiler commented 6 years ago

Ok I fixed it by adding generated WhirlyGlobeMaplyComponent.framework under Build Phases to Link Binary With Libraries

but now it fails with some C errors ?:

Showing Recent Messages
CompileC /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/Objects-normal/x86_64/DDXMLDocument.o /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/damian/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/damian/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fmodule-name=WhirlyGlobeMaplyComponent -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DDEBUG=1 -DDEBUG=1 -DHAVE_PTHREAD=1 -DNOTPODSPECWG=1 -DUNORDERED=1 -DLASZIPDLL_EXPORTS=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -fobjc-abi-version=2 -fobjc-legacy-dispatch -index-store-path /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Index/DataStore -iquote /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/WhirlyGlobeMaplyComponent-generated-files.hmap -I/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/WhirlyGlobeMaplyComponent-own-target-headers.hmap -I/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/WhirlyGlobeMaplyComponent-all-non-framework-target-headers.hmap -ivfsoverlay /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/all-product-headers.yaml -iquote /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/WhirlyGlobeMaplyComponent-project-headers.hmap -I/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Products/Debug-iphonesimulator/include -I../WhirlyGlobeLib/include -I../../third-party/eigen -I../../third-party/proj-4/src -I../../third-party/KissXML/KissXML -I../../third-party -I../../third-party/protobuf/src -I/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent/include/private -I/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent/include/vector_tiles -I/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/WhirlyGlobe-MaplyComponent/include -I../../third-party/SMCalloutView -I../../third-party/KissXML/KissXML/Additions -I../../third-party/KissXML/KissXML/Categories -I../../third-party/KissXML/KissXML/Private -I../../third-party/fmdb/src/fmdb -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/libxml2 -I../local_libs/aaplus -I../../third-party/laszip/include/laszip -I/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/DerivedSources/x86_64 -I/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/DerivedSources -F/Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Products/Debug-iphonesimulator -DEIGEN_MPL2_ONLY -fembed-bitcode -MMD -MT dependencies -MF /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/Objects-normal/x86_64/DDXMLDocument.d --serialize-diagnostics /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/Objects-normal/x86_64/DDXMLDocument.dia -c /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m -o /Users/damian/Library/Developer/Xcode/DerivedData/WhirlySources-fdomdeqfptmhuraeodunxcnhoqle/Build/Intermediates.noindex/WhirlyGlobeMaplyComponent.build/Debug-iphonesimulator/WhirlyGlobeMaplyComponent.build/Objects-normal/x86_64/DDXMLDocument.o

In file included from /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:2:
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/Categories/NSString+DDXML.h:20:20: warning: this function declaration is not a prototype [-Wstrict-prototypes]
void DDXMLDummyFunc();
                   ^
                    void
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:92:2: error: implicit declaration of function 'xmlKeepBlanksDefault' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        xmlKeepBlanksDefault(0);
        ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:92:2: error: declaration of 'xmlKeepBlanksDefault' must be imported from module 'libxml2.parser' before it is required
In module 'libxml2' imported from /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLNode.h:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/libxml2/libxml/parser.h:852:3: note: previous declaration is here
                xmlKeepBlanksDefault    (int val);
                ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:92:2: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        xmlKeepBlanksDefault(0);
        ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:94:18: error: implicit declaration of function 'xmlParseMemory' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        xmlDocPtr doc = xmlParseMemory([data bytes], [data length]);
                        ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:94:18: error: declaration of 'xmlParseMemory' must be imported from module 'libxml2.parser' before it is required
In module 'libxml2' imported from /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLNode.h:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/libxml2/libxml/parser.h:846:3: note: previous declaration is here
                xmlParseMemory          (const char *buffer,
                ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:94:18: warning: this function declaration is not a prototype [-Wstrict-prototypes]
        xmlDocPtr doc = xmlParseMemory([data bytes], [data length]);
                        ^
/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLDocument.m:94:18: error: conflicting types for 'xmlParseMemory'
In module 'libxml2' imported from /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/KissXML/DDXMLNode.h:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk/usr/include/libxml2/libxml/parser.h:846:3: note: previous declaration is here
                xmlParseMemory          (const char *buffer,
                ^
3 warnings and 5 errors generated.
jerzykiler commented 6 years ago

Ok I fixed it by adding

import <libxml/parser.h>

at the top of KissXML/DDXMLDocument.m

but now it fails with other errors:

/Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/aaplus/AADynamicalTime.cpp:625:3: error: expected '}' { 2457937.00, 69 }, //2017.5 ^ /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/aaplus/AADynamicalTime.cpp:88:1: note: to match this '{' { ^ /Users/damian/repos_learning/WhirlySources/WhirlySources/libs/WhirlyGlobeMaply/WhirlyGlobeSrc/local_libs/aaplus/AADynamicalTime.cpp:698:34: error: invalid application of 'sizeof' to an incomplete type 'const DeltaTValue []' size_t nLookupElements = sizeof(g_DeltaTValues) / sizeof(DeltaTValue); ^~~~ 2 errors generated.

Why am I getting these errors ? Should I get them or is there some magical bash script that fixes them for me ? Did I do something wrong ?

mousebird commented 6 years ago

An Objective-C file probably doesn't like C++ would be my guess. I'm not sure where this has gone.

The submodule approach should compile fine, as should the Cocoapod out of the develop branch.

jerzykiler commented 6 years ago

It compiles fine if I don't change anything.

But if I add `

import "vector_tiles/GeoJSONSource.h"

to the bridging header, so I can useGeoJSONSource`, those errors appear.

Should I do something else with GeoJSONSource.h to get it working ?

mousebird commented 6 years ago

It depends on what you're compiling against. If you're using a precompiled binary the vector_tiles may not be in there. If you're using a submodule you need to define the constant NOTPODSPECWG and it should pull in those header.

jerzykiler commented 6 years ago

Thanks, it worked :)