cancel
Showing results for 
Search instead for 
Did you mean: 

IAR Linking problem

achourwissem
Associate II
Posted on June 19, 2013 at 20:08

hello

i have a folder contains many projects and all of them goes to same library file , each projects work great , but when i copy the main code of one project to other i got the linking problem like that ''Error[Li005]: no definition for....''

18 REPLIES 18
achourwissem
Associate II
Posted on June 20, 2013 at 13:32

Error[Li005]: no definition for ''RCC_APB2PeriphClockCmd'' [referenced from C:\Users\Wissem\Desktop\my work\Debug\Obj\main.o]

Error[Li005]: no definition for ''GPIO_Init'' [referenced from C:\Users\Wissem\Desktop\my work\Debug\Obj\main.o]

Error[Li005]: no definition for ''SYSCFG_EXTILineConfig'' [referenced from C:\Users\Wissem\Desktop\my work\Debug\Obj\main.o]

Error[Li005]: no definition for ''EXTI_Init'' [referenced from C:\Users\Wissem\Desktop\my work\Debug\Obj\main.o]

Error[Li005]: no definition for ''NVIC_Init'' [referenced from C:\Users\Wissem\Desktop\my work\Debug\Obj\main.o]

frankmeyer9
Associate II
Posted on June 20, 2013 at 13:53

Does the ''offending'' source file include a device-specific header like stm32fxxx.h ?

(''#include ''stm32f4xx.h'' in the case of STM32F4).

Do you have the define ''USE_STDPERIPH_DRIVER'' added to your project settings ?

Take closer look at a working example project, and try to understand how this StdPeriph_Lib headers are working.

achourwissem
Associate II
Posted on June 20, 2013 at 15:40

everything is okay , even i got two projects from ST site and they work great , but when i copy one source code to the other project this error comes up , all the libraries are in the right path just it says ''no definition...'' so it seems like the compiler read the fonction but it didnt find its source  code

frankmeyer9
Associate II
Posted on June 20, 2013 at 16:28

everything is okay , even i got two projects from ST site and they work great , but when i copy one source code to the other project this error comes up , all the libraries are in the right path just it says ''no definition...'' so it seems like the compiler read the fonction but it didnt find its source code

Did you check what I recommended - probably not ? Do you have the define ''USE_STDPERIPH_DRIVER'' added to your project settings ? Find the stm32f4xx.h file, open it in the editor, and search for the string '' USE_STDPERIPH_DRIVER''. If you look more closely, you will notice that stm32f4xx.h includes the stm32f4xx_conf.h file ONLY if this macro is defined. In my version at lines 7812 ff:

#ifdef USE_STDPERIPH_DRIVER
#include ''stm32f4xx_conf.h''
#endif /* USE_STDPERIPH_DRIVER */

The file stm32f4xx_conf.h in turn includes the StdPeriph_Lib headers, where all those missing structs etc. are defined. Hence you need to define this macro globally (for the whole project). The best place are the project/build settings. Of course you need to have such a file stm32f4xx_conf.h in your project. If necessary, copy one over from another project, and adapt it. Again: Take closer look at a working example project, and try to understand how this StdPeriph_Lib headers are working.
frankmeyer9
Associate II
Posted on June 20, 2013 at 16:30

And BTW, you need to add the required/used StdPeriph_Lib source files to your project, too.

Amel NASRI
ST Employee
Posted on June 20, 2013 at 16:31

Then you have to consider the includes & preprocessors in the project from which you copied.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

achourwissem
Associate II
Posted on June 20, 2013 at 16:58

trust me it works and i tried it on my board , but when i copy an another working project on the same workspace i got this errors

ps: every library is inculded and nothing is missing
achourwissem
Associate II
Posted on June 20, 2013 at 16:59

the two projects have the prerocessus and includes paths

Posted on June 20, 2013 at 17:25

everything is okay , even i got two projects from ST site and they work great , but when i copy one source code to the other project this error comes up , all the libraries are in the right path just it says ''no definition...'' so it seems like the compiler read the fonction but it didnt find its source  code

Copying the files is not enough, you have to clone the project and retain the meta-data (include paths, defines, optimization, settings, etc) associated with the project.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..