Clash Tune : tune your armies, clash enemies !

I think this is because you need to link all the files in one command line.
The problem is that pathfinder.o can’t find the jumpSearch function, so you should to compile each file separately, THEN link all the files in one command :

gcc -D_JNI_IMPLEMENTATION_ -Wl, -shared -o libpathfinder.dylib pathfinder.o main.o jumppointsearch.o floodfill.o queue.o -framework JavaVM

Thanks for the command-lines but still no luck.


localhost:src sriharshachilakapati$ gcc -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -O3 -Wall -c -fmessage-length=0 -o queue.o queue.c
localhost:src sriharshachilakapati$ gcc -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -O3 -Wall -c -fmessage-length=0 -o jumppointsearch.o jumppointsearch.c
localhost:src sriharshachilakapati$ gcc -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -O3 -Wall -c -fmessage-length=0 -o floodfill.o floodfill.c
localhost:src sriharshachilakapati$ gcc -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -O3 -Wall -c -fmessage-length=0 -o main.o main.c
localhost:src sriharshachilakapati$ gcc -D_JNI_IMPLEMENTATION_ -Wl -dynamiclib -o libpathfinder.dylib queue.o main.o jumppointsearch.o floodfill.o
Undefined symbols for architecture x86_64:
  "_init_queue", referenced from:
      _floodfill in floodfill.o
  "_jumpPointSearch", referenced from:
      _Java_com_clashtune_pathfind_Pathfinder_jumpPointSearchNative in main.o
     (maybe you meant: _Java_com_clashtune_pathfind_Pathfinder_jumpPointSearchNative)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I’ve created a JNI Project in Xcode and copied these source files into it. Same errors there as well.

Can I ask a question on StackOverflow?

Yes, if you want.
Gosh, you are so near from the solution…

@titoasty
I posted the question here.

Just a question, @titoasty, I don’t know why you can’t just make a jar file with the mac osx libs inside it?

EDIT:
or the linux libs, for that matter.

@masteryoom
He didn’t have a mac to compile his native libs. I’m having trouble getting them to work since I never used libraries in C.

Can’t he just send you the source code?

EDIT:
It looks like someone made referencing errors… thats as far as I can see

@masteryoom
It’s his source code that I’m trying to compile. He sent the code to me by message.

Isn’t this made in Java? :clue:

@masteryoom
He used JNI to load some native libraries. It’s the JNI library I’m trying to compile.

I sent SHC the source code.
The problem is that I have a native lib in C for pathfinding, and I don’t have a mac (or even linux) to compile the library. Stucked under windows !

@titoasty
Can you say what steps you did to do it on windows? I’ve installed CDT as well but MinGW isn’t available for macs. The only compiler that exists for mac is the Apple GCC.

Nothing special…
I installed Mingw, then Eclipse CDT which recognized Mingw.
And then I created a new C++ project and everything compiled easily.
I really don’t understand why there is this problem…

@titoasty
Same result with the CDT too. Maybe this is a related to Apple’s linker.

It built successfully! The IDE is using Objective C compiler as default for some reason. Changing the language to C++ in the settings made it work. Can you say how can I test the library? It’s named [icode]libpathfinder.dylib[/icode]

Oh god, so cool !!!
Please send me the file and I’ll prepare you a mac version ! :slight_smile:

It’s here. http://www.weebly.com/uploads/2/7/9/6/2796142/libpathfinder.dylib

Will you give me a credit?

Haha yes for sure !
With “SHC” or another name ?

As Sri Harsha Chilakapati (SHC). Thanks!

Works perfectly!

Do you want me to create a mac app bundle?