Undifined Reference error when using a Static library in a C project

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Undifined Reference error when using a Static library in a C project

2,204 次查看
ViduraErandika
Contributor II

I build a CPP static library including FREERtos POSIX C files and also some of my own CPP files with functions that use the included FREERtos POSIX functions itself. (such as pthread_create , pthread_join etc.)

After building a .a static library I wish to use it in a C project.

In my executable project I included the static library and headers. When I call the functions that were in FREERtos POSIX C files (such as pthread_create , pthread_join etc.) through the project C file the program works perfectly.

But if I call the CPP functions that were in my own CPP files that use the included FREERtos POSIX functions it says Undefined Reference to pthread_create, pthread_join etc.

What is the reason for this error?

ps: I included the CPP files headers in the executable project including extern C tag.

标签 (1)
标记 (1)
0 项奖励
回复
1 回复

2,169 次查看
CarlosGarabito
NXP TechSupport
NXP TechSupport

Hi Vidura, i think that you have a error because

- You can get a reference error about pthread when pthread.h is missing in your C code.
- Another name for pthreads is POSIX threads.

I recommend to you an excellent blog which talks about freeRTOS and you can learn so much about this

https://mcuoneclipse.com/tag/freertos/

Have a good day

0 项奖励
回复