ta-lib

Discussion in 'App Development' started by sma202, Sep 5, 2011.

  1. sma202

    sma202

    has anyone used ta-lib here? I'm having compile issues with the c library
     
  2. Eugen_ModulusFE

    Eugen_ModulusFE ET Sponsor

    Hi,

    Yes I did use it and it compiled fine under C++ and C#. I did use the solution file form "trunk\ta-lib\c\ide\vs2008\lib_proj\" folder.

    What kind of compile errors do you have?
     
  3. sma202

    sma202

    I'm getting a linker error under vs2010, under c++->general I added the includes in "talib\c\include" for the header. Under linker->general I added the folder "talib\c\lib":

    I get this error:

    1>test.obj : error LNK2001: unresolved external symbol TA_MA
    1>test.obj : error LNK2001: unresolved external symbol TA_Initialize
    ..\talibtest\x64\Debug\talibtest.exe : fatal error LNK1120: 2 unresolved externals

    this was the test program, it won't even compile:

    #include <iostream>
    #include "ta_libc.h"

    int main() {
    TA_Initialize();

    TA_Real closePrice[400];
    TA_Real out[400];
    TA_Integer outBeg;
    TA_Integer outNbElement;
    int retCode = 0;
    retCode = TA_MA( 0, 399,
    &closePrice[0],
    30,TA_MAType_SMA,
    &outBeg, &outNbElement, &out[0] );

    int i = 0;
    /* The output is displayed here */
    for( i=0; i < outNbElement; i++ )
    printf( "Day %d = %f\n", outBeg+i, out );

    return 0;
    }
     
  4. Eugen_ModulusFE

    Eugen_ModulusFE ET Sponsor

    Go under
    Project Settings / Linker / Input / Additional Dependencies and add an entry for ta_libc_cdd.lib. That's the missing part.
     
  5. sma202

    sma202

    thanks, that solved the issue for win32, but I guess I need to recompile the libs for 64bit, have you done that? I was just using the included lib files in the msvc project.
     
  6. Eugen_ModulusFE

    Eugen_ModulusFE ET Sponsor

    yes, I did that, it compiled and linked just fine. I used the 'cdd' configuration under x64 platform.

    if you want a compiled version of libraries take them from here http://modulusfe.com/temp/ta-lib-x64.zip

    let me know if you have any issues with that.
     
  7. sma202

    sma202

    thanks, that worked.