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.

CCS/CC2640R2F: Cannot open source file "pthread.h"

Part Number: CC2640R2F


Tool/software: Code Composer Studio

I am attempting to merge elements of a small sample project I made based off one of the I2C example projects into a modified Simple Peripheral project, but I am having issues with including pthread.h. I am sure that I'm simply missing something in the Code Composer Studio UI that adds it to my include path, but I cannot find it for the life of me.

The full error is:

#1965 cannot open source file "pthread.h"

I found a solved thread here that states the poster "forgot to add the POSIX to the app_ble.cfg file", but I am unsure of what exactly that means or how to go about doing it myself.

Any help would be greatly appreciated.

  • These types of error typically occur because the compiler is not able to find the path to the header file.

    In the case of CC2640R2 SDK, the pthread.h file is in the \source\ti\posix\ccs directory within the SDK installation. Is that path added to your project's compiler include path (under Project Properties->Build->Compiler->Include Options)? 

  • Thanks for the reply.

    I managed to resolve the original issue by including the directory you mentioned in the include options, but now I am facing a new problem. Despite being able to include the headers, the linker cannot resolve the symbols that I'm using from them. For example:

    unresolved symbol mq_open, first referenced in ./Startup/main.obj
    unresolved symbol mq_send, first referenced in ./Application/aggregatortask.obj
    unresolved symbol pthread_attr_init, first referenced in ./Startup/main.obj
    unresolved symbol pthread_attr_setdetachstate, first referenced in ./Startup/main.obj
    unresolved symbol pthread_attr_setschedparam, first referenced in ./Startup/main.obj
    unresolved symbol pthread_attr_setstacksize, first referenced in ./Startup/main.obj
    unresolved symbol pthread_create, first referenced in ./Startup/main.obj
    unresolved symbol sem_init, first referenced in ./Startup/main.obj
    unresolved symbol sem_post, first referenced in ./Application/aggregatortask.obj

    Any ideas on how to resolve this too? I assume adding something to the linker paths, but I am unsure where it may be.

  • These types of linker errors typically appear when the symbols are being referenced from the source code but its definition cannot be found. Usually these definitions are either in another source file in the project or in a library that is linked to the project. 

    Having said that, I believe the experts in the device forum will be in a better position to guide you specifically on where these routines may be defined. Since the original question in this post has been resolved, I would suggest creating a new post in the Bluetooth forum for assistance with this specific question.

  • I have opened a new thread to continue seeking a solution to this issue. It can be found here.