Some undefined reference errors


iv’e been struggling for a long time now to run my app on my phone.
i’ve installed all the sdl2 and extension libraries as explained at lazy foo tutorials.
right now I have five files in my jni/src folder : main.cpp , mainScreen.cpp, mainScreen.h, gameWindow.cpp, gameWindow.h.

i get the following errors when running ndk-build from androidprojects/jni :

undefined reference to mainScreen::mainScreen();
undefined reference to mainScreen::initialize();
undefined reference to mainScreen::loadstartScreen();

and more errors like it from main.cpp , it seems to stop building at:
any idea at all?
as a side note, woudl it be possible to use some online emulator to test my app for android?
my code works fine on my laptop(laptop version code) , only i can’t test the touch functionality off course of my mobile version.

oke so do I need to change the include paths in the jni/src file to include addtional source and header files ? is it even possible to use multiple files ?

thanks :slight_smile: hope to get some answer soon, anything, i’ve been at this for two weeks now , getting my app to run on a phone :grimacing:

Also, rendering textures is not working in even teh simplest program, while it works fine on my laptop , why
?? Please help I’m so tired of being stuck :frowning:

[quote=“justadot, post:2, topic:22321”]
iv’e been struggling for a long time now to run my app on my phone.
i’ve installed all the sdl2 and extension libraries as explained at lazy foo tutorials.[/quote]

I know this isn’t very helpful but I also followed the LazyFoo tutorials for Android and everything worked - I haven’t had any of the problems you describe.

One tip is to switch to using the OpenGL renderer (instead of Direct3D) in your Windows version because that might pick up some bugs that are causing the code to fail in Android.

This may or may not be helpful, but if you are willing to take 1 step
back, maybe you can then go 2 steps forward.

I’m developing an SDK called Blurrr which ships with a bunch of
pre-built SDL libraries and provides a unified build system around
CMake. There is also a strong emphasis on cross-platform, including
Android. The types of things you are struggling with are unfortunately
pretty common, which is one of the reasons I made Blurrr. This will
require you to take a step back and transplant your code, but the
existing templates and code examples should get you to a working state
across all platforms including Android.

As for emulators, I don’t know of any online, but you could use the
official Android emulator. It’s not great, but it has been improving
and may be usable depending on what you are doing. Here is a video I
did about it. (The demos are written with SDL.)


can someone just tell me at least why I can’t even texture a simple image , while it works fine on my laptop??

i get some errors that’ it’s overriding or ignoring commands with jpeg , but they move by very fast and dissapear.
I also go some error message : dlopen failed: library not found

someone please help , i’ve been stuck on this at least 2 weeks , it feels so hopeless :frowning:

The error means that either you tried loading the library
but it failed (could be many reasons: bad binary, wrong load order,
wrong architecture, wrong name, forgot to bundle, etc.) or a library
you used depends on and you didn’t provide this.

This type of error is often fatal and will prevent your code from
further executing.

-Eric is used by SDL_mixer to play .mod files. If you don’t need to
play .mod files, you can disable that option in SDL_mixer’s
modify the SUPPORT_MOD_MIKMOD line, changing the “true” to “false”.
Jacob Lifshay

Thanks for the replies. I tried with what some suggested but no luck.
For now, I’m just going to try to embed my game in a webpage.

I found two options:

I’m just wondering which would be best for a beginner ? :slight_smile:

Emscripten is really cool. I’m having a lot of fun with it, although being a sort of dark magic, it takes a little effort to get started, so it wouldn’t be something I’d start with as a “beginner,” depending on what that means.

But it can do cool things with C++ games that use OpenGL, OpenAL, and SDL, like the original Unreal Tournament:

Thanks for all the replies . Really appreciated, but nothing worked.
Not installing Emscripten,not android studio with SDL support , not in the command prompt (lazy foo tutorials 52/53) I tried it all. Lost weeks of time wasted on nothing.

In the end I give up and I’m hoping that someone could help me in another way.

Would it be possible that I email the code and all the images and sound files (to whoever is willing to help) , and this person compiles it in both Emscripten (for the html version ) and
maybe Android studio to turn it into an app ? And then emails me back the html version and link to google play (or such not sure how it would be done) For a fee off course , but go easy I’m just a poor student :stuck_out_tongue: thanks!

To your earlier question,
Emscripten is still a tool in heavy development. I would not consider
it a beginner friendly project. While Android is one of the hardest
platforms to build for, Emscripten still has a lot of its own areas
which I wouldn’t consider beginner friendly. Here I would have
normally said, ‘but you can always try it’, but it sounds like you
already did.

As for that other tool, I don’t know anything about it, but I suspect
they don’t have any built-in support for SDL. So you will be taking a
bunch of steps back and starting over and I suspect their focus is not
in the same area as SDL focuses on (i.e. games, multimedia). And they
would have you write other things.

I think Blurrr is a much better path for you as it comes with SDL
projects that build out of the box, but I’m biased :stuck_out_tongue:

Anyway, it breaks my heart to hear you are frustrated and about to
give up. I can’t promise anything, but if your project is simple, time
permitting, I’ll try to dump it into Blurrr and see if I can get it
running on Android. (Again no promises.) If I get that working, then
I’ll hand it back to you and you can continue your adventure. This is
the email I use for this list which you can contact me directly at:
ewmailing a-t


Thanks Eric , really appreciated :slight_smile: Is it oke I email you everything in about a week (or put it all online somewhere whichever is easiest) ? As I still have to change all the temporary images( more then 150 ) for permanent ones :slight_smile:

Which ever you want to do is fine with me.


I was thinking. Would you (Eric ) , or anybody really, be willing to try to set up Android studio with SDL2 support remotely ? As well as Emscripten ? Otherwise I will still want to try with Blur .
But I would like to have these programs installed on my laptop so I can do more .

Thanks :slight_smile: