2

I am trying to build my android application with support for OpenSceneGraph. I am trying to render a simple box from my project's raw folder. However, when I build the project I am getting this compile error in the FileUtils class of the OpenSceneGraph library:

Class 'stat64' doesn't have constructor stat64(const char *,stat64*)

Any ideas what is causing the problem?

image

Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
  • 1
    You need to paste the code for your constructor, this could be a missing specific constructor for the arguments that you are using. – exs Jul 04 '17 at 19:48
  • @exs I can't even go to the class implementation. When I Ctrl + Click on the ''stat64' I am taken to the header file 'stat.h' – Georgi Koemdzhiev Jul 04 '17 at 19:50
  • 1
    So, this is not a code (class) that you created, look into how you are declaring your instance of the class and how it is expected on the header declaration for the class constructor, you might be missing a parameter, a data type could be incorrect or something else is not as the compiler expects the class to construct. – exs Jul 04 '17 at 19:56
  • 1
    Short answer: *Class 'stat64' doesn't have constructor stat64(const char *,stat64 *)*. For a longer and more clear answer, you should provide a declaration of `stat64` class. – iehrlich Jul 04 '17 at 20:12
  • @iehrlich Thank you for the suggestions. However, this piece of code is not mine, it comes from the OpenSceneGraph library. The FileUtils class is locate here -> https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgDB/FileUtils.cpp The error I am getting is in every "if( stat64(path.c_str(), &stubf) == 0)" line in the file. – Georgi Koemdzhiev Jul 05 '17 at 08:45

1 Answers1

1

I'm also faced with such problem when I have tried to compile OpenSceneGraph to Android. The problem is that NDK's <sys/stat.h> header for Android API less that 21 doesn't contain stat64 function definition so compiler thinks that stat64 is a struct. Problem can be solved by adding

#if defined(ANDROID) || defined(__ANDROID__)
#if __ANDROID_API__ < 21
  #define stat64 stat
#endif
#endif

after src/osgDB/FileUtils.cpp:92.

Kamil Zaripov
  • 904
  • 11
  • 33