Wednesday, December 22, 2010

Working with ARToolKit Plus on the iPhone

To help everyone who wants to use ARToolKit Plus on the iPhone. This post describes how to compile ARTKP in an XCode project.
First you need to get ARTKP, there are two major versions online. One is the official v2.1, and the second is the “cleaner” v2.2. This is the one you want to download, otherwise you’ll suffer a lot… Take my word! Grab v2.2 from here and extract its contents  (All rights reserved to their respective owners, and if there are some copyrights that I infringe by uploading the file, someone please tell me and I will take it down ASAP)

Now for the steps:
  1. Open XCode and create a new project. Then Create a group to add the ARTKP files into.
  2. Add the “include” and “src” folders from ARTKP folder you extracted, make sure you check the “copy items to destination folder if needed”.

  3. You need to retain only the .cpp and the .h files. Delete all other files.
  4. Delete the matlab folder, otherwise you’ll get errors.
  5. Add the path to the “include” folder you just added to the header search path in XCode project settings: 



  6. Compile and Voila!
I will address how to use ARTKP in the next post

3 comments:

  1. Thanks a lot Mahamed A Nassar for sharing the information. I followed all the steps but when i build the project i got 4 error in matrix.cpp file , then again according to your guidelines ,
    "I have found the problem. It is in the version of ARTKP you are using. Are you sure it is 2.2.0?! You can try the following; in the matrix.cpp file, add the following to the beginning of the file after the #include math:

    #ifdef __APPLE__
    #include
    #else
    #include
    #endif

    This is a problem with the version you are using, see if it gets solved by the above solution and let me know!"
    i inserted the code then it build successfully.

    Take care,
    May you happy and successful in your life.
    Rehman

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. You can get around this by changing #include <malloc.h> to become #include <stdlib.h>

    ReplyDelete