User forums > Embedded development
Including IAR-specific Library Function Definitions
(1/1)
Elliott99:
I am building a generic CodeBlocks project using the IAR compiler.
When I attempt to build, I get the error message:
"Error[Li005]: no definition for "__write" [referenced from
putchar.o(dl7M_tlf.a)]"
It seems that the linker cannot find a definition for the IAR library function __write. The IAR compiler includes a definition for this library function in the installation directory arm/src/lib/file, where there is a write.c file. Adding the write.c file directly to the project allows me to fully link and generate a project executable. The problem is, this is very clunky and as other people at my job will be using this CodeBlocks + IAR framework, I'd prefer to not have to include a long relative path dependent on the install location of the IAR compiler.
Is there some compiler-dependent flag I can use to avoid this? Perhaps I can redirect the __write library Or some better inclusion method that doesn;t involve including a very long relative path? Even just defining a dummy void write() function somewhere?
stahta01:
https://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_My_build_fails_with_multiple_undefined_reference_errors.3F
That link says what I guess your problem is.
If you post a full re-build log I can possibly confirm that is your problem.
Link to how to post a build log https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Elliott99:
Thanks for the reply, and apologies for the slow response.
Attached is the rebuild log. As I said before, directly including the write.c file as one of the compiler targets fixes this, but directly including a very long absolute path to the IAR library source files seems like a poor solution.
stahta01:
A wild guess from Google results is trying "-r" in other linker options.
You will likely need to figure out how to look at and understand the output of your Compiler and Linker.
This will likely result in your reading the manual for both of them.
Edit: If the "-r" option does not make a difference, I would remove the option.
Edit3: I really wish you read and followed the links! Because you did not you are going to get poor feedback. Goodbye!
Tim S.
stahta01:
You have the folder "Trojan Battery Dropbox" implies a special folder. You might try not using a special folder.
Edit: If I was you, I would search for libraries in the compiler installation folder, likely with ".a" extension and try them in the CB project library list one at a time till I find the one to fix the first linking error you got.
Tim S.
Navigation
[0] Message Index
Go to full version