Template instantiation on HP aCC compiler

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rpmohan

    Template instantiation on HP aCC compiler

    Hello,
    I have sample Program called sample.C . The source code looks like
    below.
    #include <List.h>

    int main(int argc, char *argv[])
    {

    List<int> myList;
    return 0;
    }

    When I compile this program, I am getting Linker error below

    /usr/ccs/bin/ld: Unsatisfied symbols:
    List<int>::List ()%1 (code)
    List<int>::~Lis t() (code)

    I attempted to compile this program with different options...

    1) aCC +inst_compileti me -I- -I/opt/aCC/include/SC sample.C

    2) aCC +inst_auto -I- -I/opt/aCC/include/SC sample.C

    3) aCC +inst_all -I- -I/opt/aCC/include/SC sample.C


    What could be wrong in my compiler options.

    I am compiling this program on HP-UNIX 10.2
    Compiler version:
    /opt/aCC/bin/aCC:
    HP aC++ B3910B A.01.23
    HP aC++ B3910B A.01.19.02 Language Support Library


    Could anyone help me regarding the same.
  • Alf P. Steinbach

    #2
    Re: Template instantiation on HP aCC compiler

    On 20 Oct 2003 22:49:48 -0700, rpmohan@yahoo.c om (rpmohan) wrote:
    [color=blue]
    >Hello,
    > I have sample Program called sample.C . The source code looks like
    >below.
    > #include <List.h>[/color]

    That's not a standard header, but perhaps you meant to
    include <list>.

    [color=blue]
    >
    > int main(int argc, char *argv[])
    > {
    >
    > List<int> myList;
    > return 0;
    > }[/color]

    It's possible you meant to write std::list<int>.

    [color=blue]
    >
    > When I compile this program, I am getting Linker error below
    >
    > /usr/ccs/bin/ld: Unsatisfied symbols:
    > List<int>::List ()%1 (code)
    > List<int>::~Lis t() (code)
    >
    > I attempted to compile this program with different options...
    >
    > 1) aCC +inst_compileti me -I- -I/opt/aCC/include/SC sample.C
    >
    > 2) aCC +inst_auto -I- -I/opt/aCC/include/SC sample.C
    >
    > 3) aCC +inst_all -I- -I/opt/aCC/include/SC sample.C
    >
    >
    > What could be wrong in my compiler options.[/color]

    That's off-topic in this group.

    Comment

    • Jan Gerrit Kootstra

      #3
      Re: Template instantiation on HP aCC compiler

      "rpmohan" <rpmohan@yahoo. com> schreef in bericht
      news:5b070e88.0 310202149.333e4 ca0@posting.goo gle.com...[color=blue]
      > Hello,
      > I have sample Program called sample.C . The source code looks like
      > below.
      > #include <List.h>
      >
      > int main(int argc, char *argv[])
      > {
      >
      > List<int> myList;
      > return 0;
      > }
      >
      > When I compile this program, I am getting Linker error below
      >
      > /usr/ccs/bin/ld: Unsatisfied symbols:
      > List<int>::List ()%1 (code)
      > List<int>::~Lis t() (code)
      >
      > I attempted to compile this program with different options...
      >
      > 1) aCC +inst_compileti me -I- -I/opt/aCC/include/SC sample.C
      >
      > 2) aCC +inst_auto -I- -I/opt/aCC/include/SC sample.C
      >
      > 3) aCC +inst_all -I- -I/opt/aCC/include/SC sample.C
      >
      >
      > What could be wrong in my compiler options.
      >
      > I am compiling this program on HP-UNIX 10.2
      > Compiler version:
      > /opt/aCC/bin/aCC:
      > HP aC++ B3910B A.01.23
      > HP aC++ B3910B A.01.19.02 Language Support Library
      >
      >
      > Could anyone help me regarding the same.[/color]

      rpmohan,


      Do you have the header file List.h on your system? C is case sensitve.


      Regards,


      Jan Gerrit


      Comment

      • Rolf Magnus

        #4
        Re: Template instantiation on HP aCC compiler

        rpmohan wrote:
        [color=blue]
        > Hello,
        > I have sample Program called sample.C . The source code looks like
        > below.
        > #include <List.h>
        >
        > int main(int argc, char *argv[])
        > {
        >
        > List<int> myList;
        > return 0;
        > }
        >
        > When I compile this program, I am getting Linker error below
        >
        > /usr/ccs/bin/ld: Unsatisfied symbols:
        > List<int>::List ()%1 (code)
        > List<int>::~Lis t() (code)[/color]

        The above shows that the compiler seems to be finding the class
        definition, but the linker isn't finding any implementation of the
        constructor and destructor. Maybe you put them in another translation
        unit? That's not possible unless your compiler supports the export
        keyword. Try putting the implementations of your List constructor and
        destructor into the header file.

        Comment

        • Dennis Handly

          #5
          Re: Template instantiation on HP aCC compiler

          rpmohan (rpmohan@yahoo. com) wrote:
          : #include <List.h>
          : When I compile this program, I am getting Linker error below
          : ld: Unsatisfied symbols: List<int>::List ()%1 (code)

          : 2) aCC +inst_auto -I/opt/aCC/include/SC sample.C
          : 3) aCC +inst_all -I/opt/aCC/include/SC sample.C

          These are obsolete +inst* options.

          : What could be wrong in my compiler options?

          The correct option is +inst_implicit_ include.
          http://h21007.www2.hp. com/dspp/tech/tech_TechDocume ntDetailPage_ID X/1,1701,1744!3!7 ,00.html#RN.CVT .2.4.1

          Comment

          Working...