Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: arechavel on February 24, 2012, 11:51:34 pm

Title: I get a linker error when building a program for an avr project
Post by: arechavel on February 24, 2012, 11:51:34 pm
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
Title: Re: I get a linker error when building a program for an avr project
Post by: stahta01 on February 25, 2012, 12:15:51 am
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 (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.
Title: Re: I get a linker error when building a program for an avr project
Post by: Radek on February 26, 2012, 08:02:41 am
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.
Title: Re: I get a linker error when building a program for an avr project
Post by: arechavel on February 27, 2012, 11:40:00 pm
My problem was in the setting tab -> complier and debugger -> selected complier should be GNU AVR GCC Compiler
it was GNUGCC Compiler

ar