C programming: How can I get snprintf to work?

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
41
Location
Kongo Jungle
XP
5,094
Country
I'm integrating bits of GodMode9 into my custom A9LH payload. One of the parts I need uses the C function snprintf. When I compile GodMode9, this works fine. But when I compile my own software I get a warning about an implicit declaration, and then the following error at the end of the build process:

Code:
/opt/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/lib/libsysbase.a(sbrk.o): In function `_sbrk_r':
(.text+0x6c): undefined reference to `__end__'
collect2: error: ld returned 1 exit status
make[1]: *** [build/payload_stage2.elf] Error 1
make: *** [stage2] Error 2

If I comment out the line with snprintf, it compiles fine. I have included stdio.h in the .c file which uses this function but it hasn't made any difference. I then checked the makefile and found that it was set to c11, so I changed it to c99 but this also made no difference. I then noticed that there are some differences between the C flags in the makefiles for GodMode9 and my own programme:

  • GodMode9 has the following flags which mine does not: -g -Wpedantic -Wcast-align -pedantic -march=armv5te -mtune=arm946e-s -fomit-frame-pointer
  • My software has the following flags which GodMode9 does not: -MMD -MP -mcpu=arm946e-s -fno-builtin -Wno-main

Does anybody know if any of these flags are responsible for me not being able to use snprintf and if so, how can I get around this?

Thanks in advance!
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
41
Location
Kongo Jungle
XP
5,094
Country
@JoostinOnline
Thanks for your reply. The calls to snprintf() are quite deeply embedded within other functions so it's hard to post a snippet. However, in the end the solution was to set the CFLAGS in the makefile of 3DSafe to be the same as those in GodMode9 and to include <stdio.h>. It builds and works now :)
 
  • Like
Reactions: JoostinOnline

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • crafthp434 @ crafthp434:
    aroma
  • NinStar @ NinStar:
    in that case, there is no such thing as homebrew launcher for aroma
  • NinStar @ NinStar:
    you have to launch your homebrews directly from the wii u menu
  • NinStar @ NinStar:
    there is a plugin that display them on the wii u menu, pretty sure it is enabled by default
  • crafthp434 @ crafthp434:
    so like it doesnt exist
  • crafthp434 @ crafthp434:
    yeah
    ?
  • NinStar @ NinStar:
    it doesn't exist, at least not for aroma
  • crafthp434 @ crafthp434:
    ohhhhh
  • NinStar @ NinStar:
    on tiramisu you can access it by opening mii maker
  • crafthp434 @ crafthp434:
    okay
  • NinStar @ NinStar:
    I don't have a wii u anymore to test it myself, but if homebrews are not visible on the wii u menu I think you can press L + R + minus to open the plugin menu, there should be an option called "homebrews on wii u menu" or something similar
  • crafthp434 @ crafthp434:
    nope
  • crafthp434 @ crafthp434:
    it is L+dpad down+ select
  • crafthp434 @ crafthp434:
    but homebrew is appearing in the home menu btw
  • NinStar @ NinStar:
    yes, now I remember it
  • NinStar @ NinStar:
    then it is working, I also don't like that they did this but it is the only option you have if you are using aroma
  • crafthp434 @ crafthp434:
    i just didint know the homebrew launcher didint exist in aroma
  • crafthp434 @ crafthp434:
    thanks btw
  • Xdqwerty @ Xdqwerty:
    Im downloading fallout 3 goty edition
    +1
  • BigOnYa @ BigOnYa:
    I'm downloading more ram for my hamster pc
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    New hamster PC, with anal operation and BT connectivity!
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, How do I make enemies respawn on gdevelop after
    the player dies?
  • Psionic Roshambo @ Psionic Roshambo:
    Carrying a PC or phone is so old school!
  • Psionic Roshambo @ Psionic Roshambo:
    Squeeze your cheeks twice to answer calls!
    Psionic Roshambo @ Psionic Roshambo: Squeeze your cheeks twice to answer calls!