Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Visual Studio 2010 - build failing ( main.cc and transform.cc )

Anonymous
2013-08-05
2014-01-27

  • Anonymous
    2013-08-05

    I am trying to compile the latest code on github to get the JPEG2000 quality level fix. I have encountered two problems, one of which I think there is an easy solution.

    setenv() and unsetenv() are not defined in VC++, but we can copy the solution used in FIF.cc and just add this code chunk into main.cc:

    // If necessary, define missing setenv and unsetenv functions

    ifndef HAVE_SETENV

    static void setenv(char n, char v, int x) {
    char buf[256];
    snprintf(buf,sizeof(buf),"%s=%s",n,v);
    putenv(buf);
    }
    static void unsetenv(char env_name) {
    extern char environ;
    char
    cc;
    int l;
    l=strlen(env_name);
    for (cc=environ;
    cc!=NULL;cc++) {
    if (strncmp(env_name,cc,l)==0 && ((cc)[l]=='='||(cc)[l]=='\0')) break;
    } for (;
    cc != NULL; cc++) *cc=cc[1];
    }

    endif

    (Well, at least that gets me as far as clearing the errors in the compilation).

    However, the changes to transform.cc on May 27th introduced std::isfinite and then the subsequent July 9th change added more references to this unsupported function (in VS).

    Could someone take a look at this and add support for VS compilation?

    It seems like using std::numeric_limits, rather than std:isfinite, would make this code Visual Studio compliant.

    If I can reroute my C#-spoiled brain around this code and work out a solution, I will post it here as well.

     
  • Ruven
    Ruven
    2013-08-06

    I've moved the setenv/unsetenv functions to Main.cc as they are no longer needed in FIF.cc.

    The std::isfinite is needed for 32bit floating point image transforms. Is std::numeric_limits a drop-in replacement? If you find an equivalent that works in VS, I'd be happy to change it.

     

    • Anonymous
      2014-01-15

      Did anyone manage to compile latest code from github with VC++ and kakadu support?
      I fixed isfinite problem with this template:

      template<typename T=""> bool isfinite(T arg)
      {
      return arg == arg &&
      arg != std::numeric_limits<T>::infinity() &&
      arg != -std::numeric_limits<T>::infinity();
      }

      Now it compiles but breaks at linking stage:

      1>Task.obj : error LNK2001: unresolved external symbol "public: virtual void cdecl PFL::run(struct Session *,class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > const &)" (?run@PFL@@UEAAXPEAUSession@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
      1>jp2.obj : error LNK2001: unresolved external symbol "void (
      cdecl kdu_convert_ycc_to_rgb_irrev32)(float ,float ,float ,int)" (?kdu_convert_ycc_to_rgb_irrev32@@3P6AXPEAM00H@ZEA)
      1>jp2.obj : error LNK2001: unresolved external symbol "void (cdecl kdu_convert_ycc_to_rgb_irrev16)(short ,short ,short ,int)" (?kdu_convert_ycc_to_rgb_irrev16@@3P6AXPEAF00H@ZEA)
      1>jp2.obj : error LNK2001: unresolved external symbol "void (
      cdecl kdu_convert_ycc_to_rgb_rev16)(short ,short ,short ,int)" (?kdu_convert_ycc_to_rgb_rev16@@3P6AXPEAF00H@ZEA)
      1>jp2.obj : error LNK2001: unresolved external symbol "void (__cdecl kdu_convert_ycc_to_rgb_rev32)(int ,int ,int ,int)" (?kdu_convert_ycc_to_rgb_rev32@@3P6AXPEAH00H@ZEA)

      I'm using kakadu 7.2.2. Any clues?

       
  • Ruven
    Ruven
    2014-01-24

    For the linking, did this work with previous versions of Kakadu and/or iipsrv?

     

  • Anonymous
    2014-01-25

    Yes, it worked with kakadu version 6.4.
    I found out later what was the problem. I just needed to add symbol CORESYS_IMPORTS to the compiler pre-defines, so here it is if someone else gets stuck with building with latest kakadu versions.
    As for the Task.obj not linking, I needed to comment out call to PFL which is OK since I don't need that SPECTRA functionality.
    Btw. in the latest visual studio 2013, they added all the missing functions (including "round", "isfinite") so everything builds without problems.

     
  • Ruven
    Ruven
    2014-01-25

    OK, thanks, that's good to know.

    For PFL, what exactly was the error?

     

  • Anonymous
    2014-01-27

    Actually PFL was OK as well. It just wasn't added to VC++ project so I had to add it manually.

     


Anonymous


Cancel   Add attachments