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.

Compiler/EK-TM4C1294XL: Own source file - Error #10234-D

Part Number: EK-TM4C1294XL


Tool/software: TI C/C++ Compiler

Hi,

I wrote a piece of source code and I have the .h and .c files that d not give an error upon compiling. As soon as I insert a void or something like it in my main code, I get the error message that unresolved symbols remain. 

The .c code:

#include <stdint.h>

#define POOL_LENGTH 32
uint32_t list[POOL_LENGTH];
//-----------------------------------------------
#define struct poolobject_t
{
    uint32_t* value;
    struct poolobject_t* next;

} poolobject;
//-----------------------------------------------
poolobject pointers[POOL_LENGTH];
poolobject* available;
poolobject* available_tail;
poolobject* usedup;
poolobject* usedup_tail;
//-----------------------------------------------
void setUpPool()
{
    int i;
    for (i=0;i<POOL_LENGTH-1;i++)
    {
        pointers[i].next = &pointers[i+1];
    }
    pointers[POOL_LENGTH-1].next = 0;
    available = &pointers[0];
    available_tail = &pointers[POOL_LENGTH-1];
    usedup = 0;
    usedup_tail = 0;
}
//-----------------------------------------------
uint32_t* getObject()
{
    poolobject* temp;
    if (available!=0)
    {
        temp = available;
        available = available->next;
        if (usedup==0)
        {
            usedup = temp;
            usedup_tail = temp;
        }
        else
        {
            usedup_tail->next =temp;
            usedup_tail = usedup_tail->next;
        }
        return temp->value;
    }
    else return 0;
}
//-----------------------------------------------
void releaseObject(uint32_t *obj)
{
    if(usedup!=0)
    {
        poolobject* ptr = usedup;
        usedup = usedup->next;
        ptr->value = obj;
        if(available == 0)
        {
            available = ptr;
            available_tail = ptr;
        }
        else
        {
            available_tail->next = ptr;
            available_tail = available_tail->next;
        }
    }
}

The .h code:

#include <stdint.h>

void setUpPool();
//typedef poolobject_t;
//void setUpPool();
extern uint32_t* getObject();
extern void releaseObject(uint32_t *obj);

Can someone tell me what I am doing wrong/missing?

Jonas.

  • I will point a few errors that I see.  But I will not address every error.

    Don't mix #define and a struct declaration like this ...

    jonas Verbeke said:
    #define struct poolobject_t
    {
    uint32_t* value;
    struct poolobject_t* next;
    }
    poolobject;

    That's not how #define is used.  In this particular case, just remove the #define.

    Please read through this FAQ (not from TI) about the difference between a declaration and a definition, and how they are typically organized in source code.  Please note that this ...

    struct poolobject_t
    {
        uint32_t* value;
        struct poolobject_t* next;
    } poolobject;

    ... is a declaration, and thus typically appears in a header file.

    I'm sure that is not every error.  But it is a start.  I recommend you work with a colleague who is an expert in C.  This forum is not about learning to program in C.

    Thanks and regards,

    -George