undefined reference to `__ctype'

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

undefined reference to `__ctype'

3,745件の閲覧回数
neoxiong
NXP Employee
NXP Employee

HI, MCUXpresso Expert

When I include <ctype.h> and call isdigit('A') function, during link stage, it report 'undefined reference to `__ctype'.

This only happens when I use connectivity example project, when uses driver example project, there is no problem. 

I had tried to change several library format, it still has the same issue.

Environment: MCUxpresso 10.1.1

SDK: QN908x GA

4 返答(返信)

3,207件の閲覧回数
lpcxpresso_supp
NXP Employee
NXP Employee

I believe that this link issue is caused because the "Connectivity" projects having being configured so they use their own linker scripts and library support rather than the "normal" IDE functionality. I suspect that your problem is being triggered by the project effectively using the C library header files from Redlib, but then linking against other C library archives.  And Redlib implements ctype differently.

Check the value in:

  • Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU C Compiler -> Library headers

and if it says "Redlib (Auto)" try changing this to "Newlib (Auto)" instead, then rebuild.

Regards,

MCUXpresso IDE Support

3,207件の閲覧回数
neoxiong
NXP Employee
NXP Employee

hi, I create a new connectivity project and select newlib in wizard, it is ok now.

But if the project was created already and selected Redlib, I can't just switch to newlib. If I click manager link script, it will disable use my .ld

I want use both my .ld and newlib for existing project.

0 件の賞賛
返信

3,207件の閲覧回数
mihaidragnea
NXP Employee
NXP Employee

Hi Neo,

There is a workaround that you can do to have both QN908XC_connectivity.ld and newlib library selected for an existing connectivity project. Here is how:

1. Go to Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU Linker -> Managed Linker Script

2. Copy the text from Linker script edit box, i.e "QN908XC_connectivity.ld"

pastedImage_1.png

3. Select Manage linker script check-box

pastedImage_4.png

4. Change library to Newlib

pastedImage_3.png

5. Uncheck Manage linker script and paste back the original QN908XC_connectivity.ld file

pastedImage_5.png

6. Apply and close

7. Rebuild the project

Regards,

Mihai DRAGNEA

3,207件の閲覧回数
neoxiong
NXP Employee
NXP Employee

Hi, Expert

Do you mean the 'Library headers' setting in 'Miscellaneous' ? It is strange that I change from 'Redlib (Auto)' to 'Newlib (Auto)' and click apply & OK, next time I open the project setting, it is still 'Redlib (Auto)'. I think we need change library instead of headers?

In other SDK driver example project, it is Redlib, and I have no problem. 

Another point is I noticed driver examples uses 'Managed Link script' instead of .ld file, while connectivity project uses .ld. 

0 件の賞賛
返信