Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / [Tier 2] Multiple definitions of <function> linking problem

Author
Message
victordavion
7
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 5th Apr 2012 18:34 Edited at: 5th Apr 2012 18:37
Backstory: In order to freshen up and relearn C++ and OOP programming in general, I'm rewriting a game I made in Tier 1 into Tier 2.
I'm wanting to still write once and deploy to Windows + Android.
Wow am I noticing a huge difference in standards between GCC (or Make) & VC++. I have code that works fine in VC++ and I'm under the impression that in order to compile it for Android I need to copy my source files (the ones that I wrote) into the /jni/ folder, and add them to the Android.mk source file list.

It seems to be compiling OK, but fails during the linking process. It's claiming it's running into multiple definitions of the same functions. I can assure you I've only defined my functions once, and I have made precautions avoiding circular dependencies.

Anyway, I'm going to zip up my source files here, I've removed the actual game code. I just want the skeleton app to work. Notice in Application.mk I added the line: APP_STL := stlport_static in order to use the std library (like vector<>, etc).

Attachments

Login to view attachments
victordavion
7
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 5th Apr 2012 20:43
I solved it.

Solution: You cannot have a main.c & main.cpp, because they both compile into main.o. DERP!!!!!!
Hope no one else runs into this.

Login to post a reply

Server time is: 2019-10-18 21:48:11
Your offset time is: 2019-10-18 21:48:11