Skip to content

stb_image_write: fix linker errors in HDR image functions when STBI_WRITE_NO_STDIO is defined#1959

Open
sanjay-nambiar wants to merge 2 commits into
nothings:masterfrom
sanjay-nambiar:fix_image_write_linker_error
Open

stb_image_write: fix linker errors in HDR image functions when STBI_WRITE_NO_STDIO is defined#1959
sanjay-nambiar wants to merge 2 commits into
nothings:masterfrom
sanjay-nambiar:fix_image_write_linker_error

Conversation

@sanjay-nambiar

Copy link
Copy Markdown

Calling any of the HDR image write functions with STBI_WRITE_NO_STDIO defined results in an undefined symbol linker error. This is because all the HDR write function definitions are guarded with STBI_WRITE_NO_STDIO macro when only the function that writes directly to a file - stbi_write_hdr should be under the include guard.

Fixing this requires removing one usage of sprintf used when writing an HDR image header. Implemented a simple unsigned int to string function to replace sprintf, borrowing code from stb_sprintf.

@nothings

nothings commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Do not borrow from stb_sprintf; that function is not designed to be simple, but to be fast, and we don't need speed here. A much shorter function will do.

@sanjay-nambiar

Copy link
Copy Markdown
Author

Updated the function to be a much simpler one. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants