tags:

views:

435

answers:

2

Hi,

I am trying to #include an application tlb file in VC++ project.

Getting following compilation errors, after #import "CANoe.tlb" in my project source file. -

  • unknown character '0x1'
  • syntax error : missing ';' before identifier 'A'
  • missing type specifier
  • int assumed. Note: C++ does not support default-int
  • '{' : missing function header (old-style formal list?)

Please suggest, if I am doing some wrong.

Also, is there a way to verify the .tlb file contents and resolve these errors. Is it possible to make corrections in tlb file ? If so, how do I create a updated tlb

Thanks in advance

+3  A: 

My first thought is that you are dealing with a file that is not a TLB. Or at least, is corrupted.

I would try and bring up the TLB in OleView. This should give you a quick sanity check that the TLB is or is not valid.

JaredPar
A: 

If the type library file is intact the next step is to try find the generated .tlh and .tli files - they will be located in some temporary folder and have the same name as type library file and ".tlh"/".tli" extensions. If they exist examining them might help a lot.

import directive does two things - it builds the ".tlh" and ".tli" files and then includes them - the error messages correspond to the second stage - when the C++ compiler just refuses to compile them. Examining the files will likely help identify the reason.

sharptooth