Archived Forum Post

Index of archived forum posts

Question:

How to include chilkat library in the xcode ios project?

Nov 05 '14 at 06:00

I have downloaded the chilkat lib files & made a universal lib file. I have added it through target>build phases>link binary with libraries>+ and then selected the file.

How to import the .h files now?

When i use the example codes, I get "undeclared identifier" error. How to proceed with this?

Thanks, Augustin


Answer

Here are the steps I followed to successfully link w/ Chilkat:

1) Create a new iOS application project. I chose Single-View Application.

2) Do nothing further at this point other than to make whatever changes are necessary in the Build Settings to run the empty app on your device. Verify that it runs on your device. You should get nothing more than a white screen that does nothing.

3) Add an "empty.cpp" source file to your project. The empty.cpp is an empty file with the name "empty.cpp".

4) I named my project "UnitTest", so in UnitTestViewController.m, add the #import statement for "CkoEmail.h"

5) Add this line in the viewDidLoad method: CkoEmail *email = [[CkoEmail alloc]init];

6) Try building the project -- you should get the unresolved symbol error.

7) Add the libchilkatIos.a library to your project. Do this by right-clicking on "Add Files to ...", then navigate to the directory where the device version of "libchilkatIos.a" is located and add it to your project.

8) Try building the project again -- all should be OK.

You've now created a project that does nothing. It simply instantiates a Chilkat object (CkoEmail) and does nothing more. But you've demonstrated that linking with libchilkatIos.a is OK.


Answer

You include the Chilkat header (.h) file using #import or #include. As a C, C++, or Objective-C developer, you should be familiar with "#include".

In the C language, the #include pre-compile directive always causes a file's contents to be inserted into the source at that point. Objective-C has the equivalent #import directive except each file is included only once per compilation unit, obviating the need for include guards.


Answer

I have done everything upto point no.7. While I tried to build I am still getting the error

----- Use of undeclared identifier 'CkoEmail'

Thanks & Regards, AUGUSTIN.S


Answer

Hi,

Thanks for the update. When I include the CkoEmail.h file it says "CkoEmail.h" file not found.

AUGUSTIN.S


Answer

It is assumed that if you are programming in Objective-C, you should be familiar with the "#import" preprocessor directive. (You should also be familiar with #include.)

#import is basic Objective-C programming knowledge. If you are not familiar with it, then you need to learn Objective-C a little better. It is beyond Chilkat's capacity to teach customers the fundamentals their prospective programming language: C++, Objective-C, Perl, Python, C#, VB.NET, ASP, Ruby, Java, Delphi, C, FoxPro, etc.


Answer

Dear Chilkat,

I think you have misunderstood what I have mentioned. I have followed exactly all the steps mentioned here & also I have imported the file like #import "CkoEmail.h". I am getting the error as in the screenshot below. Please let me know if I miss anything.

alt text


Answer

Even after renaming the file to ViewController.mm, I am getting the same error. Please find the screenshot below.

alt text


Answer

You need to change your 'Header Search Paths', if you are using xcode5,

Click on your project, on the center panel, click 'Build Settings', find Search Paths, then edit Header Search Paths, for example mine

/Users/keating/Desktop/AppLibraries/Chilkat-9.4.0-IOS-6.0/include