[Linker error] undefined reference to `TIFFOpen'

Kuoyang Hu
2014-03-09
2014-03-10
  • Kuoyang Hu
    Kuoyang Hu
    2014-03-09

    I am using Dev-C++ 4.9.9.2.

    I want to capture some information from TIFF file and I write a simple “TestTIF.c” and included “tiffio.h”. I compiled the TestTIF.c and get follow errors.

    Error as follow:
    1. [Linker error] undefined reference to TIFFOpen' 2. [Linker error] undefined reference toTIFFClose'

    The TestTIF.s as follow:

    include <stdio.h>

    include <string.h>

    include "./include/tiffio.h"

    include "./include/tiffconf.h"

    include "./include/tiff.h"

    main()
    {
    TIFF* tif = TIFFOpen("300Lx4P.tif", "r");
    printf("Test...\n");
    TIFFClose(tif);
    }

    Can you help me, let me know, what happen and how can I do the next?

    Thank & regards,
    Kuoyang Hu

     
  • Merak
    Merak
    2014-03-09

    Seems you have forgotten to include the library...

    I have no idea what it's name is but i suspect tiff.lib or tiff.a...

     
  • Kuoyang Hu
    Kuoyang Hu
    2014-03-10

    I have put all of files (tiffio.h, tiffconf.h, tiff.h) into folder (./include) and write follow statement as follow:

    include "./include/tiffio.h"

    include "./include/tiffconf.h"

    include "./include/tiff.h"

    Is it correctly? If NOT, how to include the library?

     
  • Merak
    Merak
    2014-03-10

    I stopped using dev-c++ and instead use code::blocks, but if I remember correctly it's under project->build options...

    Also, a complete rebuild might solve the issue

     
  • Kuoyang Hu
    Kuoyang Hu
    2014-03-10

    Thanks.

    I am not a professional developer, I just want to get an image width and length. Dev-C++ is a shareware and match I short term need. Actually, I don't know how to use project in Dev-C++.

    How to do the next? I am think now. give up or...

    Thanks again.

     
  • Kuoyang Hu
    Kuoyang Hu
    2014-03-10

    What happen.

    I created a project and keep the setup as default then copied all of statement “TestTIF.c” into project then compiled it, it done and runnable.

    Thank you again. Now I know how to do the next.