jlaurens / synctex

Synchronization for TeX
MIT License
57 stars 19 forks source link

Error when compiling: implicit declaration of function `vasprintf` #80

Closed vidraj closed 3 months ago

vidraj commented 3 months ago

When compiling with -Werror=implicit-function-declaration (currently the default with modern compilers), synctex_parser.c fails to compile with

synctex_parser.c: In function '_synctex_updater_print_gz':
synctex_parser.c:8703:13: error: implicit declaration of function 'vasprintf'; did you mean 'vsprintf'? [-Werror=implicit-function-declaration]

This is due to a missing feature test macro – vasprintf is only exposed in stdio.h when _GNU_SOURCE is defined.

A fix for this error was already merged into the 2020 branch in pull request https://github.com/jlaurens/synctex/pull/39, but didn't make it to the other branches.

jlaurens commented 3 months ago

The actual branches are main for cutting edge development and 2024 for more stable features. Both seem to define _GNU_SOURCE.

vidraj commented 3 months ago

OK, I didn't see it in the 2020.1 branch, which seemed to me like the one-version-newer. I thought I grepped for it in the main branch as well, but I must've messed up either the grepping or the branch checkouts – I apologize for that and thank you for the correction.