CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Posts
    5

    Linking error- LNK2001

    Hi ,

    I have written program in 'c' and 'ada' . 'c' program call function existing in ada. I have compiled 'c' program in 'c' compiler and 'ada' program in ada compiler. I have gernerated obj of both 'c' and 'ada' programs. Now I want link together and generate dll. While compilation I am not having any problem but while linking I am getting link error - LNK 2001.
    I am compiling these two programs on command prompt.
    Please suggest me some solution.

    Here are commands I am using compilation:
    ----------------------------------------------------
    'c' program compilation command :
    cl -c MY_DLL.c

    'ada' program compilation command:
    adacomp -gc -asm adacode.ada

    Here is Linking command I am using for linking above two objs
    ------------------------------------------------------------------------------
    link MY_DLL.obj adacode.obj /NODEFAULTLIB:libcmt.lib -dll


    I am getting following linking error:
    --------------------------------------------

    >link MY_DLL.obj adacode.obj /NODEFAULTLIB:libcmt.lib -dll

    Microsoft (R) Incremental Linker
    Version 6.00.8447 Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

    Creating library MY_DLL.lib and object MY_DLL.exp LINK : warning LNK4049: locally defined symbol "_YOUR_DLL" imported

    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.check_curre nt_input

    adacode.obj :error LNK2001: unresolved external symbol _rts_remove_exception_an d_tcb

    adacode.obj : error LNK2001: unresolved external symbol ada.text_io.close
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.integer_io_ support.put__2
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.check_curre nt_output
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.integer_io_ support.put
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.integer_io_ support.get__2
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io.current_inpu t
    adacode.obj : error LNK2001: unresolved external symbol ada.io_exceptions.data_e rror
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io.current_outp ut
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io_.integer_io_ support.get
    adacode.obj : error LNK2001: unresolved external symbol _rts_set_exception_and_t cb
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io.create
    adacode.obj : error LNK2001: unresolved external symbol ada.text_io.put_line__2
    MY_DLL.dll : fatal error LNK1120:16 unresolved externals


    Please help in solving these linking errors.

    For your reference I am attaching my files.

    I am waiting for reply.

    Cheers,

    Praveen

  2. #2
    Join Date
    May 2000
    Location
    Phoenix, AZ [USA]
    Posts
    1,347
    I have never programmed in ada and I have never linked with an
    ada module, however it looks like your errors are referring to
    generic ada stuff. By that, I mean the function names look similar
    to what you'd find in standard C. If there's an "ada C-runtime
    library" or something like that, I think you should link with that.
    It looks like your ada module requires your C programs to link
    with that module and an additional library, but I could be wrong
    having no ada experience whatsoever.

    --Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured