Beginner: How do I actually use gperf? It just hangs every time I run it

808 views Asked by At

I am very new to coding, currently taking Harvard's CS50x class online. The extent of my familiarity with code, languages, and environments is what they've taught me so far in C. With vague guidance from other questions on this site, I've taken about 4 days to install gperf, from discovering what Cygwin is to installing all of its libraries and error-checking the installation all the way up to finding out where it finally put the installed program. I was so happy when I actually found the application 'gperf.exe' just now. I thought I was finally just about to get the hash function I've been trying to make for almost a week.

And now, the program does nothing but hang every time I try to run it, no error messages. Offering no input file causes it to hang. Doing any amount of and selection of options specified in the manual, it just hangs. Even debugging says it's entering debugging, then just hangs. The only way I've been able to get the program to respond at all is offering it an invalid input file, which it says is invalid. Nothing else does anything; no output file, no command-line response, nothing. I am frustrated to the point of tears, and the documentation provided with gperf assumes you're a professional coder, talking endlessly about the hundreds of high-level customization options to modify the program, but not a word about how to make it just run on a basic level. I've searched Google and this site extensively, and very little pops up as soon as I search for gperf related issues specifically.

Can anyone please just walk me through how to make this program work? I'm sure it's some stupid little thing that I'm missing, but all I want it to do is take my input file of strings and give me a hash function in C. Any and all help is appreciated, I have absolutely no clue what I'm doing and even installing gperf was a multi-day process that is far beyond the scope of what I've done so far.

Thank you.

EDIT: Executions I've tried passing: gperf ./gperf

Arguments I've tried passing: -a -c -d --output-file 'FILE'

I have tried all of these with and without the inclusion of my input file, named 'keys' and 'keys.txt'. The only thing that has generated any response from the program has been giving it an incorrect input-file name, giving the result 'could not load input file 'keys''.

1

There are 1 answers

0
Bruno Haible On BEST ANSWER

gperf can be slow if the input file you give it is large, that is, contains many keys. You can get an impression of what are "small" files vs. "large" files by looking at the documentation: Known bugs and limitations.