This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to add standard library (VLIB.lib) in "static library created" project

Hi ,

I am creating my own static library with VLIB function call .

I have created one sample project for static lib creation with VLIB function and it compiled also .

I have created a normal project (with executable .out as output) and linked the earlier static library project to this .

When I compiled this project am getting linking error like below :


undefined           first referenced
symbol              in file
---------                ----------------
VLIB_imagePyramid8(const unsigned char *, unsigned short, unsigned short, unsigned char *) C:\Users\userworkspace_v5_4\STATIC_LIB_TRY\Debug\STATIC_LIB_TRY.lib<sample.obj>

My Question is How to link library to the static library project .

So ,I will link vlib.lib to MY STATIC_LIB_TRY proj and can get rid of the error .

Please do not consider this as different forums discussion and post it to other .

Consider this as generic error and tell me how to link one library to static library creation project in CCS .

CCS = v5.4 + Windows + 64 bit 

C66x simulator 

  • studinstru sggs said:
    My Question is How to link library to the static library project .

    As long as vlib.lib is linked to the executable project along with your own static library, it should be sufficient to resolve the reference.

    Can you post the linker command as seen in the CCS build console? You may need to make some adjustments to the order in which the libraries are passed to the linker, or use the --reread_libs option, for the symbols to get resolved properly.

  • Thanks AartiG .
    PFB linker command file that I am using .
    I just verified the code .when I am running code with "main.c" file ,code is successfully building .
    But when I tried to use "main.cpp" file I am getting the mentioned error .
    Is there any thing like VLIB library will run with 'c' files only not with 'cpp' files ??


    /* Linker for DSP1 instance, not DSP2 */

    -stack 0x40000
    -heap 0x8000000

    -l C:/ti/vlib_c66x_3_2_1_0/packages/ti/vlib/lib/vlib.lib
    -l C:/ti/vlib_c66x_3_2_1_0/packages/ti/vlib/lib/vlib_cn.lib
    -l C:/ti/vlib_c66x_3_2_1_0/packages/ti/vlib/lib/common.lib


    MEMORY {

    L1P_SRAM : origin = 0x00E00000, len = 0x8000
    L1D_SRAM : origin = 0x00F00000, len = 0x7000
    L2_SRAM : origin = 0x00800000, len = 0x48000
    DSP2_L2_SRAM : origin = 0x40800000, len = 0x48000
    SL2_SRAM : origin = 0x5B000000, len = 0x40000
    EXT_MEM : origin = 0x80000000, len = 0x1F000000
    EXT_MEM_NONCACHE : origin = 0x9F000000, len = 0x01000000
    }

    SECTIONS
    {
    vectors :> EXT_MEM
    .cinit :> EXT_MEM
    .cio :> EXT_MEM
    .text :> EXT_MEM
    .stack :> DSP2_L2_SRAM
    .bss :> EXT_MEM
    .const :> EXT_MEM
    .far :> EXT_MEM
    .fardata :> EXT_MEM
    .neardata :> EXT_MEM
    .rodata :> EXT_MEM
    .sysmem :> EXT_MEM
    .switch :> EXT_MEM
    .dmemSect :> L1D_SRAM
    .l2memSect :> L2_SRAM
    .ddrnoncacheSect :> EXT_MEM_NONCACHE
    .init_array :>EXT_MEM
    }
  • You may be running into name mangling issues if trying to combine C and C++ code. Please see this wiki article for more information and try using extern "C" on functions that are reported in the error to defeat name mangling issues.