Load Balancing Linker Error

Options
steviegiovanni
edited April 2015 in Native
Hi,

I'm trying to use Photon-AndroidNDK_v3-2-5-7_SDK. After I tried to instantiate ExitGames::LoadBalancing::Client mLoadBalancingClient, I keep getting the following errors

src/Client.cpp:166: error: undefined reference to 'ExitGames::Photon::PhotonPeer::connect(ExitGames::Common::JString const&, unsigned char const*)'
src/Client.cpp:172: error: undefined reference to 'ExitGames::Photon::PhotonPeer::disconnect()'
../Common-cpp/inc/KeyObject.h:106: error: undefined reference to 'ExitGames::Common::Object::Object(void const*, unsigned char, unsigned char, bool)'
../Common-cpp/inc/Helpers/KeyToObject.h:31: error: undefined reference to 'ExitGames::Common::Object::Object(ExitGames::Common::Object const&)'
../Common-cpp/inc/KeyObject.h:115: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/ValueObject.h:122: error: undefined reference to 'ExitGames::Common::Object::Object(void const*, unsigned char, unsigned char, bool)'
../Common-cpp/inc/Helpers/ValueToObject.h:42: error: undefined reference to 'ExitGames::Common::Object::Object(ExitGames::Common::Object const&)'
../Common-cpp/inc/ValueObject.h:168: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Hashtable::putImplementation(ExitGames::Common::Object const&, ExitGames::Common::Object const&)'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Hashtable.h:74: error: undefined reference to 'ExitGames::Common::Object::Object()'
../Common-cpp/inc/KeyObject.h:106: error: undefined reference to 'ExitGames::Common::Object::Object(void const*, unsigned char, unsigned char, bool)'
../Common-cpp/inc/Helpers/KeyToObject.h:31: error: undefined reference to 'ExitGames::Common::Object::Object(ExitGames::Common::Object const&)'
../Common-cpp/inc/KeyObject.h:115: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Object::Object(ExitGames::Common::Object const&)'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Helpers::ValueToObject::get(ExitGames::Common::Object)'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Hashtable::putImplementation(ExitGames::Common::Object const&, ExitGames::Common::Object const&)'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Hashtable.h:76: error: undefined reference to 'ExitGames::Common::Object::~Object()'
../Common-cpp/inc/Dictionary.h:93: error: undefined reference to 'ExitGames::Common::DictionaryBase::DictionaryBase()'
src/Client.cpp:184: error: undefined reference to 'ExitGames::Photon::OperationRequest::OperationRequest(unsigned char, ExitGames::Common::Dictionary<unsigned char, ExitGames::Common::Object> const&)'
src/Client.cpp:184: error: undefined reference to 'ExitGames::Photon::OperationRequest::~OperationRequest()'
../Common-cpp/inc/Dictionary.h:106: error: undefined reference to 'ExitGames::Common::DictionaryBase::~DictionaryBase()'
../Common-cpp/inc/Dictionary.h:93: error: undefined reference to 'ExitGames::Common::DictionaryBase::DictionaryBase()'
src/Client.cpp:195: error: undefined reference to 'ExitGames::Photon::OperationRequest::OperationRequest(unsigned char, ExitGames::Common::Dictionary<unsigned char, ExitGames::Common::Object> const&)'
src/Client.cpp:195: error: undefined reference to 'ExitGames::Photon::OperationRequest::~OperationRequest()'

and so on...

I believe I've included all the .h and the prebuilt .a accordingly. What did I miss?

Comments

  • Kaiserludi
    Options
    Hi Stevie.

    That looks like the linker can't find the .a files, which contain the definitions for the functions declared in the .h.

    Please recheck the paths that you have specified for those libs.

    You could also have a look at our demo and compare what it is doing different than you application.

    This seems to be a new project of yours. Is there any particular reason why you are using the 3.2.5.7 and not the 4.0.1.1 SDK?
  • I've tried both the 3.2.5.7 and the 4.0.1.1 SDK. I think I used the 3.2.5.7 because I couldn't build the desktop version of the demo loadbalancing project for the 4.0.1.1. I've also tried to open the android loadbalancing demo project using visual studio 2010 with a trial version of visualGDB, but when I tried to build it, there's a compilation error. Do i need to modify some settings first?
  • Kaiserludi
    Options
    Are you sure that you have tried 4.0.1.1 and not 4.0.1.0? I ask, because a subfolder of the demos directory was missing from the 4.0.1.0 release, which prevented the demos from successfully building. This was fixed in 4.0.1.1.
    but when I tried to build it, there's a compilation error.
    If you need help regarding a certain error, then please always quote the exact error message. Otherwise we won't know, what could cause that specific error.
    I've also tried to open the android loadbalancing demo project using visual studio 2010 with a trial version of visualGDB, but when I tried to build it, there's a compilation error. Do I need to modify some settings first?
    There is a known issue with VisualGDB that the very first attempt to build a clean project always fails, even if everything is correct - in that case just do a second build attempt, which will then succeed.
  • Kaiserludi wrote:
    Are you sure that you have tried 4.0.1.1 and not 4.0.1.0? I ask, because a subfolder of the demos directory was missing from the 4.0.1.0 release, which prevented the demos from successfully building. This was fixed in 4.0.1.1.

    Ahhhh ok, so that was why I couldn't build it. Sorry. I didn't realize the newer version. Thanks for note there.

    The errors that I got when I tried to build the android demoLoadBalancing in visual studio with visualGDB is as below

    1> [armeabi] Compile++ thumb: demoLoadBalancing <= main.cpp
    1> [armeabi] SharedLibrary : libdemoLoadBalancing.so
    1>arm-linux-androideabi-g++ : error : jni/../../../../LoadBalancing-cpp/lib/loadbalancing-cpp-prebuilt/../../../Photon-cpp/lib/photon-cpp-prebuilt/libphoton-cpp-static_debug_android_armeabi.a: No such file or directory
    1>arm-linux-androideabi-g++ : error : jni/../../../../LoadBalancing-cpp/lib/loadbalancing-cpp-prebuilt/../../../Common-cpp/lib/common-cpp-prebuilt/libcommon-cpp-static_debug_android_armeabi.a: No such file or directory
    1> make.exe: *** [obj/local/armeabi/libdemoLoadBalancing.so] Error 1
    1>
    1> Command exited with code 2
    1> Executable: C:\Programs\android-ndk-r9d\ndk-build.cmd

    I can build the LoadBalancing-cpp with the same method just fine though (with visual studio and visual GDB)
  • Hi KaiserLudi,

    I've found the problem.

    I did
    LOCAL_STATIC_LIBRARIES := common-cpp-static-prebuilt photon-cpp-static-prebuilt loadbalancing-cpp-static-prebuilt

    instead of
    LOCAL_STATIC_LIBRARIES := loadbalancing-cpp-static-prebuilt photon-cpp-static-prebuilt common-cpp-static-prebuilt

    Thanks for the help! now, I can build my project, but I still couldn't build the demo_android_loadBalancing.
  • Kaiserludi
    Options
    Hi Stevie.

    I am not sure if I understand you correctly.
    In your previous post it sounded like you could already successfully build LoadBalancing-cpp, but only the demo would fail to build for you, but in your last post you state that you are still not able to build the demo. So what are you now able to build, that you have not been able before? LoadBalancin-cpp, your game?

    What exactly is the error that you get now when trying to build the demo? Still the one from your previous post? In that case please try to move the demo to a shorter path. This may be caused by a path length issue. Just try if it helps to move the demo to a path as short as C:\a\Demos\demo_loadBalancing, please.
  • Hi Kaiserludi

    Previously:
    - I could build loadbalancing-cpp (windows and android)
    - I could build demo_loadbalancing (windows)
    - I could not build my independent project (android)
    - I could not build demo_loadbalancing (android)

    Yesterday afternoon:
    - I could build loadbalancing-cpp (windows and android)
    - I could build demo_loadbalancing (windows)
    - I could build my independent project (android) after fixing the order of how I include PHOTON in the LOCAL_STATIC_LIBRARIES
    - I could not build demo_loadbalancing (android)

    This morning:
    - I could build loadbalancing-cpp (windows and android)
    - I could build demo_loadbalancing (windows)
    - I could build my independent project (android)
    - I could build demo_loadbalancing (android) after I move the folder to a directory with shorter path

    thanks!
  • Kaiserludi
    Options
    Hi Stevie.

    Great.

    Thanks for the update.