News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

I get a linker error when building a program for an avr project

Started by arechavel, February 24, 2012, 11:51:34 PM

Previous topic - Next topic

arechavel

I created an avr project on a linux box using the gcc-avr complier

My linker settings are:
-mmcu=atmega1284p
-Wl,-Map=$(TARGET_OUTPUT_FILE).map,--cref

I built the following c program:

#include <ctype.h>

int main(void)
{
    int a = 1;

    if(isdigit( a ))
    {
        a = 2;
    }

    return 0;
}


I got the error:

/home/arechavel/workspace/test2_project/main.c:10: undefined reference to `__ctype_b_loc'


Could you help me with this issue ???

thank you

ar

stahta01

Step 1. Turn on Full Compiler Logging
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Step 2. Post the build log on a different website that supports your Compiler.
           Ask what you are missing.
Step 3. Ask on this web-site how to add the missing items.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Radek

I tried Google a bit and I have found that you seem to have been "lucky" and that you have hit a problematic part of certain libc's. Problems with __ctype_b_loc() are reported repeatedly whenever ctype() tries to query locale settings. All reports seem to be rather old (2003 .. 2006) so that the problem should be gone now. It is possible that the AVR environment reproduces the bug. I have no experience with AVR programming. At any rate, it's not your bug, your code is okay.

Try to bypass ctype.h, use your own code. Also, there should be ctype.c somewhere around. Using this code instead of the code in libc was reported to solve the problem.

arechavel

My problem was in the setting tab -> complier and debugger -> selected complier should be GNU AVR GCC Compiler
it was GNUGCC Compiler

ar