0

I wrote a C++ static lib for Mac OS. It is for application run with smart card. Therefore, it used PCSC.framework. During compiling mylib, there is no problem and a static lib is derived. I created an application which was command line tool. I added my static lib to the application. When i created an instance from one class of the lib and called a method of the instance, i took errors undefined symbols for arcitecture x86_64: SCardConnect, SCardEstablishContext and the other pcsc functions

To solve these errors, i tried followings;

I rebuilt the static lib after changing architectures 32-bit intel from 64 bit. Then i also rebuilt test application. But errors were continued similary. Just difference from the earlier, undefined symbols for arcitecture i386.

I have PCSC for both arcitectures x86_64 and i386. libccid was for i386. i run pcsctest correctly.

Please let me know how i can solve it.

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
  • Check one of the object files within your static lib by running `file object.o` on it. Does it show both, i386 and x86_64 code? Now do the same on your application binary or one of its object files. – Till Dec 25 '13 at 13:04
  • Please don’t post the answer inside the question – people won’t find it easily. Post it as an answer instead. – Konrad Rudolph Dec 25 '13 at 13:39
  • the system didn't allow me to write an answer to my own question. so i edited my question. – user3134470 Dec 25 '13 at 14:15

1 Answers1

1

Building the static library doesn't link and resolve all the symbols of the framework. Take a look at the following similar questions:

Some alternatives to consider are:

  • Including PCSC.framework as a framework dependency of your application as you did with your library.
  • Creating a framework or dynamic library instead of a static library.
  • Calling dlopen/dlsym on PCSC.framework.
Community
  • 1
  • 1