16bit tif

Hi,

thank you for the advice.
Since I have no idea how to create/load the Root/Cint dictionary first I tried to compile the macro using .L name.C++
here is the result:[quote]11-02-08 13:20 # root .L imanali.C++
Warning in TApplication::GetOptions: macro .L not found
root [0]
Processing imanali.C++…
Info in TUnixSystem::ACLiC: creating shared library /home/lazaraza/AES/Dimana/./imanali_C.so
dlopen error: /home/lazaraza/AES/Dimana/./imanali_C.so: undefined symbol: TIFFOpen
Load Error: Failed to load Dynamic link library /home/lazaraza/AES/Dimana/./imanali_C.so
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/…/…/…/…/lib/crt1.o: In function _start': (.text+0x20): undefined reference tomain’
/home/lazaraza/AES/Dimana/imanali_C_ACLiC_dict.o: In function imanali()': imanali_C_ACLiC_dict.cxx:(.text+0x5f8): undefined reference toTIFFOpen’
imanali_C_ACLiC_dict.cxx:(.text+0x608): undefined reference to `TIFFClose’
collect2: ld returned 1 exit status
*** Interpreter error recovered ***
root [1]
[/quote]
the first strange message is .L not found, oddly enough the compilation proceeds and there is this dlopen error.
Here is the code used:[code]
#include “TSystem.h”
#include “tiffio.h”

void imanali()
{
gSystem->Load(“libtiff”);
TIFF* img_tiff = TIFFOpen(“calibration.tiff”, “r”);
TIFFClose(img_tiff);
}
[/code]
is it again the dictionary problem and if “Y” how to create the dict?

Regards,
Lazar.

p.s. (edit) another odd thing is that if I execute the macro with one plus only .L name.C+ after the compilation with the two pluses, then it is executed successfully with many error messages in the prompt.

  1. start root session.
  2. in a root session, instead of executing macro with .x macro_name.C, you compile it using .L macro_name.C++, after that, you can call your function, defined in this now compiled macro.

[quote=“lazaraza”]. . .
here is the result:[quote]11-02-08 13:20 # root .L imanali.C++

[/quote][/quote]

The command above stands for

  1. start ROOT
  2. “ask” ROOT to process the file with the name “.L”
  3. “ask” ROOT to compile, load and invoke the function with no parameters “void imanali()” from the file called " imanali.C"
    In the other words

root imanali.C++ should do what you need

Thank you both,

the result unfortunately is the same #-o
I wonder if thisquote: undefined reference to `main’ [/quote]
is a hint that I need to build application (i.e. using TApplication) instead of using scripts, what do you think?
or is it dictionary problem?

[quote]/home/lazaraza/AES/Dimana/imanali_C_ACLiC_dict.o: In function `imanali()’:
[/quote]

Your help is highly appreciated,
Lazar.

[quote]Thank you both,

the result unfortunately is the same #-o
I wonder if thisquote: undefined reference to `main’ [/quote][/quote]

I’m very sorry I gave you a non-working solution :frowning:
While I’m investigating why I did it, I can give you one more ugly workaround:

#if defined (__CINT__) && !defined(__MAKECINT__)

{
   gSystem->Load("libtiff.so");
   gROOT->LoadMacro("tiff_test.C+");
   tiff_test();
}

#else

#include <tiffio.h>

#include <TSystem.h>

void tiff_test()
{
    TIFFOpen("a", "b");//stupid parameters, just for test
}

#endif

save it as, say, tiff_test.C and in a ROOT’s console just do as with usual macro: .x tiff_test.C (without any ++ now). The part in the first conditional inclusion will load libtiff and call compiler to compile the code from the second part, which will be executed then.

P.S. I understand that it’s probably easier to right normal C++ program and compile and link it, instead of this macro with macro magic :slight_smile: But at least you still have a working ROOT’s environment “for free”.

P.P.S. Ok, I remember now, why the first solution (with undefined references in your case) worked for me :slight_smile: - I simply loaded libtiff before compiling macro (now this is done in my latest macro, in interpreted part).