5

I hope anyone from the large community here can help me write the simplest "Trusted" program that I can expand from.

I'm using Ubuntu Linux 9.04, with TPM emulator 0.60 from Mario Strasser (http://tpm-emulator.berlios.de/). I have installed the emulator and Trousers, and can successfully run programs from tpm-tools after running tpmd and tcsd daemons.

I hope to start developing my application, but I have problems compiling the code below.

#include <trousers/tss.h>
#include <trousers/trousers.h>
#include <stdio.h>

TSS_HCONTEXT hContext;
int main()
{
     Tspi_Context_Create(&hContext);
     Tspi_Context_Close(hContext);
     return 0;
}

After trying to compile with

g++ tpm.cpp -o tpmexe

I receive errors

undefined reference to 'Tspi_Context_Create' 
undefined reference to 'Tspi_Context_Close'

What do I have to #include to successfully compile this? Is there anything that I miss? I'm familiar with C, but not exactly so with Linux/Unix programming environment.

ps: I am a part time student in Master in Information Security programme. My involvement with programming has been largely for academic purposes.

idazuwaika
  • 2,749
  • 7
  • 38
  • 46

1 Answers1

3

You need to link to the library.

Try this:

g++ tpm.cpp -o tpmexe -ltspi
asveikau
  • 39,039
  • 2
  • 53
  • 68