2012/10/11 Sihan Goi <[email protected]>:
> Hi,
Hello,
> I'm developing a simple program in C using pcsclite in Ubuntu. I've
> installed libpcsclite-dev. My program simply does a SCardEstablishContext in
> main() as follows:
>
> #include <winscard.h>
> #include <reader.h>
>
> int main() {
> ULONG err;
> err = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hContext);
> if (err !=SCARD_S_SUCCESS) {
> // some error handling
> }
> return 0;
> }
>
> When I try to compile it with "gcc -I/usr/include/PCSC test.c -o test", I
> get the following error message:
>
> /tmp/ccpfq23P.o: In function `main':
> test.c:(.text+0x5d): undefined reference to `SCardEstablishContext'
> collect2: ld returned 1 exit status
>
> May I know what I'm doing wrong? Also, how do I include the PCSC directory
> into the include path? winscard.h and reader.h are already in
> /usr/include/PCSC but if I don't put -I in gcc, it doesn't detect the files.
You can reuse the Makefile from "PCSC sample in C" [1].
You should find the answers by yourself for general questions related
to compilation and link. Try to read a book about Unix compilation
tool chains.
Good luck,
[1] http://ludovicrousseau.blogspot.fr/2010/04/pcsc-sample-in-c.html
--
Dr. Ludovic Rousseau
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle