Undefined reference to "fnmatch" in LPC1788-targeting project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined reference to "fnmatch" in LPC1788-targeting project

881 Views
Eugene723
Contributor II

According to

"fnmatch" function does exist in GNU C library. Header file "fnmatch.h"  is found OK but the linker outputs the error.

 

I'm using NewlibNano.

Please help.

 

Thank you,

Eugene

Tags (2)
0 Kudos
Reply
3 Replies

796 Views
Eugene723
Contributor II

Thank you for your reply, Alex.

For the sake of experiment I tried different libraries (MCUXpresso makes it easy to switch between libraries):

Redlib: Error: fnmatch.h: No such file or directory

Newlib: Error: undefined reference to `fnmatch' 

 

Would you elaborate as to why both, Newlib and NewlibNano appear to include <fnmatch.h> but not library implementation, please? Am I correct in understanding that these libraries are open? Where on the Web can their sources be found?

 

Thanks again,

 

Eugene

0 Kudos
Reply

763 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

What you see is normal.

redlib is a C90 (and partly C99) standard compliant library designed to be as small as possible. Thus redlib does not implement fnmatch. fnmatch is part of the Single Unix Specification (POSIX) rather than the original C standard. GNU C Library commonly found in Linux user-space environments which is fully POSIX compliant. So Newlib incudes fnmatch.h but fnmatch doesn’t really implement in MCUXpresso IDE.

So MCUXpresso IDE doesn’t implement fnmatch function.

Hope this make sense.

 

Have a nice day,

Jun Zhang

0 Kudos
Reply

820 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @Eugene723 

The fnmatch function is part of the GNU C library and is defined in the header file <fnmatch.h>. However, you are using NewlibNano, which is a lightweight implementation of the standard C library that may not have all the features of the fully functional GNU C library.

If you try to use fnmatch in NewlibNano, you may run into problems because it may not be supported by NewlibNano. In this case, you can try to implement wildcard matching on your own, or look for other lightweight libraries that provide this functionality.

Best regards, Alex

0 Kudos
Reply