CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Exclamation "Undefined Reference to (method name)" When Accessing a Method in a Static Library

    I've been trying for more than one month to access a method found in a library called libcocosnas_static.a
    I'm using Cocos2d-X version 2.0.4. The library has been used many times by my company to make games using cocos2d-1.0.1-x-0.12.0 without any problem.
    This is what I've done:
    1- I added the include paths of the library to both eclipse and Android.mk
    2- Included the .h file using #include "NASPlatformUtil.h"
    3- Added the libcocosnas_static.a file to the proj.android\obj\local\armeabi folder
    4- Added "LOCAL_WHOLE_STATIC_LIBRARIES += cocosnas_static" to the Android.mk file
    5- Called the function using: NASPlatformUtil:: openUrl("http://xxx.xxx.com/");

    I can right click on the function, click Open Declaration and get it without any problem, but the compiler keeps on giving me that dreaded error
    Hope you can help me with this

    Thank you in advance
    Last edited by fifo_thekid; January 18th, 2013 at 12:57 AM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: "Undefined Reference to (method name)" When Accessing a Method in a Static Librar

    Quote Originally Posted by fifo_thekid View Post
    ...
    5- Called the function using:
    Code:
    NASPlatformUtil:: openUrl("http://xxx.xxx.com/");
    1. Does the space between :: and openUrl really exists?
    2. What is NASPlatformUtil? A class or a namespace?
    3. If it is a class is a openUrl its static method?
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2009
    Posts
    4

    Re: "Undefined Reference to (method name)" When Accessing a Method in a Static Librar

    1- No, it doesn't exist
    2- It's a class
    3- Yes, it is a static method
    Last edited by fifo_thekid; January 18th, 2013 at 02:49 AM.

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: "Undefined Reference to (method name)" When Accessing a Method in a Static Librar

    Quote Originally Posted by fifo_thekid View Post
    1- No, it doesn't exist
    2- It's a class
    3- Yes, it is a static method
    That error looks like a linker error, not a compiler error. Is it a linker error?
    I can right click on the function, click Open Declaration and get it without any problem
    That doesn't prove anything. That function could have been eliminated from the final static library when the library was being built.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; January 18th, 2013 at 06:25 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured