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.

Global Variable in Header File, Unresolved Symbol xxxx, first referenced in ./xxx [Updated]

Hey everyone.

I've a question that I sick and tired of it, nearly took my all day.

I'm using CCS 5.3.0

I'm writing a source and a header file called: ImBARAyristirv1.0.c and ImBARAyristirv1.0.h

I've created both source file and header file with this way: Right Click on Project File -> New -> Source File / Header File

So both files are contained in Project directory.

When I call a function in main.c and compile project, it gives this error.

it seems there is a linker problem, but I give the include paths.

What should I do?

I've included my files..

http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/81/ImBARAyristir_5F00_v1.0.c

http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/81/ImBARAyristir_5F00_v1.0.h

Need urgent help..

My best regards..

  • Hi Bora,

    first of all how have you been adding the path?  Is it under the linker file include paths?  This is a typical cause of an unresolved symbol error.  Also references to library has has not been included/linked in.

    Have you seen this wiki?

    http://processors.wiki.ti.com/index.php/Include_paths_and_options

    Best Regards,
    Lisa

  • Hi Lisa

    Thank you for your return.

    My include path are shown below picture.

  • Hi Bora,

    please have a look at the wiki and add the path in the linker->file search path area.

    Best Regards
    Lisa

  • Hi Lisa,

    I've already looked at the wiki but I don't get what you mean?

    I don't have lib file.

    I added the path still giving the same error.

    My regards..

  • Hi Bora,

    Do these files require a library you are missing?

    Best Regards,

    Lisa

  • Hi Lisa,

    I don't know if you have looked at the attached files. They just require these header files:

    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_can.h"
    #include "inc/hw_ints.h"
    #include "driverlib/can.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    #include "stdio.h"

    All of them included in my project file.

    My regards..

  • By the way, there is something strange that when I comment all variable defnitions in my header file, the project builds with no error.

    The are the variables:

    extern short i;

    extern char temp_h, temp_l;
    extern char euler_high;
    extern char euler_low;

    extern char bar_gelen_veri[15];
    extern char bar_giden_veri[15];

    extern int euler_deger;

    When I open the comments, the same erros occurred.

    I really don't understand what's gonig on :/

  • This variables are being used in this function:

    if(UARTCharsAvail(UART1_BASE))
    {
         bar_gelen_veri[i] = UARTCharGetNonBlocking(UART1_BASE);
         i++;
    }

    if(i == 15)
    {
         temp_h = bar_gelen_veri[9];
         temp_h = (temp_h >> 7);

         //UARTCharPutNonBlocking(UART0_BASE, temp);

        euler_high = bar_gelen_veri[9] ^ 0xFF;
        euler_low = bar_gelen_veri[10] ^ 0xFF;

       if(temp_h == 0)
       {
            //euler_deger = (((256 * euler_high) + euler_low) - 1); //(0.0109863);
            euler_deger = ((((256 * euler_high) + euler_low) - 1) * (0.0109863));
            euler_deger = euler_deger % 180;
       }
       else
       {
           //euler_deger = (((256 * euler_high) + euler_low) - 1) * (-1); //(0.0109863);
           euler_deger = ((((256 * euler_high) + euler_low) - 1) * (-1) * (0.0109863));
           euler_deger = euler_deger % 180;
       }

       //euler_deger = 98765;
       //UARTCharPutNonBlocking(UART0_BASE, 0x01);
       sprintf(bar_giden_veri, "%d", euler_deger);

       UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[0]);

       UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[1]);
       UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[2]);
       UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[3]);
       //UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[4]);
       //UARTCharPutNonBlocking(UART0_BASE, bar_giden_veri[5]);

       AltSatiraGec();

       i = 0;
    }

  • Hi Bora,

    you have to be careful how and where you declare external variables.

    See this

    http://stackoverflow.com/questions/1433204/what-are-extern-variables-in-c

    When you uncomment them does your code run fine then?

    Best Regards,
    Lisa

  • Hi Lisa,

    I realized that my definitions were not proper. I don't know why I did'nt realized before :)

    Thank you..

  • Hi Bora,

    glad to hear things are resolved for you.

    All the best with development.

    Best Regards,

    Lisa