Closed bictorv closed 2 months ago
Your solution also works, but I don't see why tcp.c or chaos.c would need supdup.h. The only definition which is used from supdup.h is USE_CHAOS_STREAM_SOCKET which wraps (essentially) all of chaos.c.
supdup.h provides declarations of chaos_connect and tcp_connect, which are common to supcup.c, chaos.c, and tcp.c.
What I did was to move definitions out from supdup.h. It's a good idea to avoid definitions in header files, and in this case it was the cause of the problem.
But only supdup.c needs the declarations of chaos_connect and tcp_connect, not the others. (I completely agree about keeping variable definitions out of .h files, but a #define is a definition, isn't it?)
It's a stylistic choice whether to have one big header file with all common declarations for the program, or many small header files each with a small scope. The former seemed to me natural with the style of supdup.c.
Sorry, I already merged another fix one minute earlier.