Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : csub and array - help please
Page 2 of 2 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4037 |
Yes, if you insist on declaring multiple variables like that then to reduce (you cannot eliminate) confusion you do want to put the * with the identifier and not with the type. Also you should be shot . Peter's way may be more sensible, but I largely work with higher-level languages where the type is one atomic keyword/identifier, not a mess of them. Best wishes, Tom Edited 2024-03-08 02:49 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
I'd like to say: yes, C is special! Very confusing for a beginner like me. Especially because wrong spelling doesn't necessarily lead to an error, just a different result. And you can get the same result with different expressions. Anyway, I'm working my way through it now. My ambition has been kindled. Matthias |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1241 |
I think it doesn't get any easier because the information about CSub is so spread out here in the forum and some of it is several years old. The - excellent! - MMBasic manual is of very little help regarding CSubs. causality ≠ correlation ≠ coincidence |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 896 |
I have started a page on FotS (Fruit of the Shed) to link to posts around CSubs. Eventually I hope it can be expanded as a complete reference for CSubs and Cfunctions(still maintaining links to the original posts). I have added a link to this page. Despite having cut and pasted Geoff and Peter's C code for a couple of years now I am still not fluent in pointer syntax and sometimes have a bit of trial and error. The explanations here are the clearest I have seen. Fruit of the Shed - CSubs Gerry Latest F4 Latest H7 |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1241 |
Fruit of the Shed - CSubs ... Very good idea! Thank you! Impressive! Maybe a reference to it could be in the manual? Best regards Michael causality ≠ correlation ≠ coincidence |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hello dear gurus, what is the fundamental problem with this error? Matthias C:\homa\csub\ray>arm-none-eabi-ld -nostartfiles -T arm-gcc-link.ld -o main.elf main.o arm-none-eabi-ld: main.o: in function `degToRad.4898': main.c:(.text.degToRad.4898+0xe): undefined reference to `__aeabi_i2d' arm-none-eabi-ld: main.c:(.text.degToRad.4898+0x16): undefined reference to `__aeabi_dmul' arm-none-eabi-ld: main.c:(.text.degToRad.4898+0x26): undefined reference to `__aeabi_ddiv' arm-none-eabi-ld: main.c:(.text.degToRad.4898+0x32): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.o: in function `ray': main.c:(.text.ray+0x36): undefined reference to `__aeabi_l2f' arm-none-eabi-ld: main.c:(.text.ray+0x48): undefined reference to `__aeabi_l2f' arm-none-eabi-ld: main.c:(.text.ray+0x5a): undefined reference to `__aeabi_l2f' arm-none-eabi-ld: main.c:(.text.ray+0x6c): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x86): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x92): undefined reference to `tan' arm-none-eabi-ld: main.c:(.text.ray+0x9e): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.c:(.text.ray+0xa8): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0xc0): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0xcc): undefined reference to `cos' arm-none-eabi-ld: main.c:(.text.ray+0xd4): undefined reference to `__aeabi_dcmpgt' arm-none-eabi-ld: main.c:(.text.ray+0xde): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0xec): undefined reference to `__aeabi_i2f' arm-none-eabi-ld: main.c:(.text.ray+0xf8): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x102): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x10c): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x126): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x132): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x14e): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x15a): undefined reference to `cos' arm-none-eabi-ld: main.c:(.text.ray+0x162): undefined reference to `__aeabi_dcmplt' arm-none-eabi-ld: main.c:(.text.ray+0x16c): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x178): undefined reference to `__aeabi_i2d' arm-none-eabi-ld: main.c:(.text.ray+0x180): undefined reference to `__aeabi_dsub' arm-none-eabi-ld: main.c:(.text.ray+0x18c): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.c:(.text.ray+0x198): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x1a2): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x1ac): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x1c4): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x1de): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x1ea): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x230): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x24a): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x256): undefined reference to `cos' arm-none-eabi-ld: main.c:(.text.ray+0x262): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x26a): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x276): undefined reference to `__aeabi_dmul' arm-none-eabi-ld: main.c:(.text.ray+0x284): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x29c): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x2a8): undefined reference to `sin' arm-none-eabi-ld: main.c:(.text.ray+0x2b4): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x2bc): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x2c8): undefined reference to `__aeabi_dmul' arm-none-eabi-ld: main.c:(.text.ray+0x2d4): undefined reference to `__aeabi_dsub' arm-none-eabi-ld: main.c:(.text.ray+0x2e0): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.c:(.text.ray+0x2ee): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x2fa): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x326): undefined reference to `__aeabi_fdiv' arm-none-eabi-ld: main.c:(.text.ray+0x330): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x34c): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x358): undefined reference to `sin' arm-none-eabi-ld: main.c:(.text.ray+0x360): undefined reference to `__aeabi_dcmpgt' arm-none-eabi-ld: main.c:(.text.ray+0x36a): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x376): undefined reference to `__aeabi_i2d' arm-none-eabi-ld: main.c:(.text.ray+0x37e): undefined reference to `__aeabi_dsub' arm-none-eabi-ld: main.c:(.text.ray+0x38a): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.c:(.text.ray+0x396): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x3a0): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x3aa): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x3c2): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x3ea): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x406): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x412): undefined reference to `sin' arm-none-eabi-ld: main.c:(.text.ray+0x41a): undefined reference to `__aeabi_dcmplt' arm-none-eabi-ld: main.c:(.text.ray+0x424): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x432): undefined reference to `__aeabi_i2f' arm-none-eabi-ld: main.c:(.text.ray+0x43e): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x448): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x452): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x46c): undefined reference to `__aeabi_fmul' arm-none-eabi-ld: main.c:(.text.ray+0x486): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x492): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x4d8): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x4f2): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x4fe): undefined reference to `cos' arm-none-eabi-ld: main.c:(.text.ray+0x50a): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x512): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x51e): undefined reference to `__aeabi_dmul' arm-none-eabi-ld: main.c:(.text.ray+0x52c): undefined reference to `__aeabi_f2iz' arm-none-eabi-ld: main.c:(.text.ray+0x544): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x550): undefined reference to `sin' arm-none-eabi-ld: main.c:(.text.ray+0x55c): undefined reference to `__aeabi_fsub' arm-none-eabi-ld: main.c:(.text.ray+0x564): undefined reference to `__aeabi_f2d' arm-none-eabi-ld: main.c:(.text.ray+0x570): undefined reference to `__aeabi_dmul' arm-none-eabi-ld: main.c:(.text.ray+0x57c): undefined reference to `__aeabi_dsub' arm-none-eabi-ld: main.c:(.text.ray+0x588): undefined reference to `__aeabi_d2f' arm-none-eabi-ld: main.c:(.text.ray+0x596): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x5a2): undefined reference to `__aeabi_fadd' arm-none-eabi-ld: main.c:(.text.ray+0x5bc): undefined reference to `__aeabi_fcmplt' arm-none-eabi-ld: main.c:(.text.ray+0x5d2): undefined reference to `__aeabi_f2lz' arm-none-eabi-ld: main.c:(.text.ray+0x5e6): undefined reference to `__aeabi_f2lz' |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9115 |
Have you been through the original cfunction tutorials? http://www.thebackshed.com/forum/forum_posts.asp?TID=7965&PN=1&TPN=1 http://www.thebackshed.com/forum/forum_posts.asp?TID=7973 http://www.thebackshed.com/forum/forum_posts.asp?TID=8038 http://www.thebackshed.com/forum/forum_posts.asp?TID=8389&KW=by+example If not you should. Although there is some PIC specific stuff a lot of it is still relevant. The answer to your question is that you are trying to do maths and this calls SDK routines which you can't link. You need to use the maths calls in the header file e.g. x=y*z; becomes x=FMul(y,z); |
||||
EDNEDN Senior Member Joined: 18/02/2023 Location: United StatesPosts: 118 |
Very confusing for a beginner like me. Especially because wrong spelling doesn't necessarily lead to an error, just a different result. And you can get the same result with different expressions. Anyway, I'm working my way through it now. My ambition has been kindled. Matthias Most people starting to do complicated things in C benefit from understanding the parsing of complex C declarations. If you read these articles, everything starts to be easy: http://unixwiz.net/techtips/reading-cdecl.html https://users.ece.utexas.edu/~ryerraballi/CPrimer/CDeclPrimer.html http://www.ericgiguere.com/articles/reading-c-declarations.html Once you can parse and understand the more complicated declarations most of the confusion disappears. Edited 2024-03-11 07:43 by EDNEDN |
||||
Page 2 of 2 |
Print this page |