2020-04-04 03:23 AM
Hi!
I am trying to compile a project from several files in Eclipse.
Function print_hello() defined in another file N222.
Resulting error: undefined reference to `print_hello '
What am I doing wrong?
regards
Alexander
2020-04-06 02:29 AM
Hi @JulianSTMhvalev ,
In your 222.c you have to write "extern void print_hello();" at the 13rd line otherwise it cannot recognize the function.
Regards,
Armand
2020-04-06 04:04 AM
Hi Armand!
done
Same error :(
Regards
Alexander/
2020-04-06 04:27 AM
Hi Alexander,
Is it working if you create a 222N.h header file where you define the hello_world function ?
Don't forget to include it in both files 222.c and 222N.c
Regards,
Armand
2020-04-06 04:40 AM
Hi Armand!
done
Same error :(
Eclipse IDE for C/C++ Developers
Version: 2020-03 (4.15.0)
Build id: 20200313-1211
Regards
Alexander
2020-04-06 07:15 AM
Hi Alexander,
On our side it's still working on Eclipse with your code. Are you sure the 222N.c file is well implemented in your project ? Because on the console, it seems like only the main file 222.c is compiled and not the 222N.c file, that's why it doesn't recognize the function. I suggest you to refresh the project to make sure the file is well implemented. By the way, what are your compiler / linker settings on Eclipse ?
Regards,
Armand
2020-04-06 11:03 PM
Hi Armand!
thank you for your help
I also think something is wrong in the linker or compiler settings
settings:
compiler:
-I/home/alexsander/STM32MPU_workspace/STM32MP15-Ecosystem-v1.2.0/Developer-Package/SDK/sysroots/x86_64-ostl_sdk-linux/usr/include -I/home/alexsander/eclipse-workspace/222/inc -O0 -g3 -Wall --sysroot=/home/alexsander/STM32MPU_workspace/STM32MP15-Ecosystem-v1.2.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7
linker:
-nostartfiles -L/home/alexsander/eclipse-workspace/222/src --sysroot=/home/alexsander/STM32MPU_workspace/STM32MP15-Ecosystem-v1.2.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi -marm -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7
I will be glad to your prompts :)
Regards
Alexander
2020-04-06 11:33 PM
Look at the log after "make all" command - file "222N.c" is not compiled at all. You have to sort out that.
2020-04-06 11:58 PM
2020-04-08 09:37 AM
So what have you done yourself while "looking"? Checked paths, file properties, compiler configuration?
I don't like Eclipse and use EmBitz instead... Probably @Pavel A. can give some advice.