Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Build android application, undefined references.  (Read 1640 times)

0 Members and 1 Guest are viewing this topic.

scayze

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Build android application, undefined references.
« on: October 26, 2016, 04:01:37 pm »
Heyho!
Im trying to build an simple SFML-application:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main(int argc, char *argv[])
{
        sf::RenderWindow window(sf::VideoMode::getDesktopMode(), sf::String(""));

        sf::CircleShape circle;
        circle.setFillColor(sf::Color::Red);
        circle.setPosition(50, 50);
        circle.setRadius(20);

        sf::View view = window.getDefaultView();

        while (window.isOpen())
        {
                sf::Event event;

                while (window.pollEvent(event))
                {
                        switch (event.type)
                        {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        case sf::Event::Resized:
                                view.setSize(event.size.width, event.size.height);
                                view.setCenter(event.size.width / 2, event.size.height / 2);
                                window.setView(view);
                                break;
                        case sf::Event::TouchBegan:
                                if (event.touch.finger == 0)
                                {
                                        circle.setPosition(event.touch.x, event.touch.y);
                                }
                                break;
                        }
                }

                window.clear(sf::Color::White);
                window.draw(circle);
                window.display();
        }
}

When im compiling im getting various undefined references:

1>  Tegra-Android/Shipping/Android2.o: In function `main':
1>  Android2.cpp:(.text.startup+0x20): undefined reference to `sf::VideoMode::getDesktopMode()'
1>  Android2.cpp:(.text.startup+0x40): undefined reference to `sf::String::String(char const*, std::locale const&)'
1>  Android2.cpp:(.text.startup+0x84): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
1>  Android2.cpp:(.text.startup+0xb8): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
1>  Android2.cpp:(.text.startup+0xcc): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
1>  Android2.cpp:(.text.startup+0xe0): undefined reference to `sf::Transformable::setPosition(float, float)'
1>  Android2.cpp:(.text.startup+0xf0): undefined reference to `sf::CircleShape::setRadius(float)'
1>  Android2.cpp:(.text.startup+0xf8): undefined reference to `sf::RenderTarget::getDefaultView() const'
1>  Android2.cpp:(.text.startup+0x110): undefined reference to `sf::Window::isOpen() const'
1>  Android2.cpp:(.text.startup+0x124): undefined reference to `sf::Window::pollEvent(sf::Event&)'
1>  Android2.cpp:(.text.startup+0x170): undefined reference to `sf::Transformable::setPosition(float, float)'
1>  Android2.cpp:(.text.startup+0x17c): undefined reference to `sf::Window::close()'
1>  Android2.cpp:(.text.startup+0x1a0): undefined reference to `sf::View::setSize(float, float)'
1>  Android2.cpp:(.text.startup+0x1d0): undefined reference to `sf::View::setCenter(float, float)'
1>  Android2.cpp:(.text.startup+0x1dc): undefined reference to `sf::RenderTarget::setView(sf::View const&)'
1>  Android2.cpp:(.text.startup+0x1f0): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
1>  Android2.cpp:(.text.startup+0x204): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
1>  Android2.cpp:(.text.startup+0x20c): undefined reference to `sf::Window::display()'
1>  Android2.cpp:(.text.startup+0x214): undefined reference to `sf::Window::isOpen() const'
1>  Android2.cpp:(.text.startup+0x23c): undefined reference to `sf::Shape::~Shape()'
1>  Android2.cpp:(.text.startup+0x244): undefined reference to `sf::RenderWindow::~RenderWindow()'
1>  Android2.cpp:(.text.startup+0x290): undefined reference to `sf::Color::Red'
1>  Android2.cpp:(.text.startup+0x294): undefined reference to `sf::Color::White'
1>  Android2.cpp:(.text.startup+0x298): undefined reference to `sf::RenderStates::Default'
1>  Android2.cpp:(.text.startup+0x29c): undefined reference to `vtable for sf::CircleShape'
1>collect2.exe : error : ld returned 1 exit status
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

Im Working with Visual Studio & NVidia Tegra

i built sfml with cmake:

cmake -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/android.toolchain.cmake ../..

and compiled & installed with VS Tegra.

Im using the NDK version r10e for compability with Tegra.


I also added the libsfml-system.so etc to the Project and added the include directory which was created by 'install' in the NDK folder.

What am i doing wrong?

is it a problem that NDK&SDK are in a folder path with spaces in it? (C:\Program Files (x86)\Android\android-ndk-r10e)

Or do i have to change anything in the AndroidManifest?

Thank you in advance!  ;D - Manu

EDIT: Compiling with MinGW makefiles/make and using those results doesnt change anything either :|
EDIT2: Moved sdk & ndk to C:\Android\ so there would be no whitespace, recompiled everything, still doesnt work  :(
« Last Edit: October 26, 2016, 05:18:42 pm by scayze »

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Build android application, undefined references.
« Reply #1 on: October 27, 2016, 02:22:14 am »
check my signature, hope you get what you need.
I would like a spanish/latin community...
Problems building for Android? Look here