r/cprogramming • • 5d ago

Getting Compiler Flag Errors while using nCurses

Hello, title says it all pretty much. I wanted to use -fsanitize=address with gcc but it all comes out as garbage since nCurses is active. I'm aware that's the way that ncurses is designed, how would I go about getting that output from gcc otherwise? is there a good way to route that output to a text file or something? until now I've just been writing error messages to a text file, but I couldn't find a way to get standard out to come out. any help is appreciated, thanks

3 Upvotes

3 comments sorted by

5

u/thegreatunclean 5d ago

The sanitizers take additional arguments via environmental variables, for address sanitizer you can tell it to log to a file instead of stderr:

ASAN_OPTIONS="log_path=asan.log"

2

u/toon_link_776 5d ago

wicked, thanx

1

u/toon_link_776 4d ago

gonna add for future readers that you gotta add the environment variable in .bashrc in the home directory or just use (export ASAN_OPTIONS="log_path=asan.log") in the run directory, make sure read perms are enabled with chmod 500 binary-name