[CLUE-Tech] Dumb C/GCC question

Keith Hellman kehellman at yahoo.com
Sun Jun 16 12:16:51 MDT 2002


I would place:

#ifndef MR_COLLECT_filter
#error MR_COLLECT_filter not defined
#else
#error MR_COLLECT_filter ok
#endif
#error GOT THIS FAR

underneath the #include "mercury_trace.h" in mercury_trace.c

Your next compile won't succeed, but you should see GOT THIS FAR as an
error.  If you see the MR_COLLECT_filter ok message, you know the error is
in the C file, if you see the not defined message, then the error is in
the sequence of header files that the C file includes.

Insert and jostle appropriate #error or #warning lines into files, until
you can deduce what the issue is...

It will probably end up being an incorrect -I param on the command line,
or some header file is #undef'ing MR_COLLECT_filter...

Good luck, these types of problems aren't complicated (usually) but
they're a pain to solve.

One piece of advice:  when you find the issue and a fix to the issue,
unpack a clean archive of the software and fix it in that, then continue
your build.  With all the #if* editting your going to be doing, it'll be
easy to accidently keep one of your debug mods in;  then you spend another
 hour determining why the silly thing won't link :^)

HTH


--- Matt Gushee <mgushee at havenrock.com> wrote:
> Hi, folks--
> 
> I am having trouble compiling a C program. The build is failing with
> this error:
> 
>   /usr/local/src/mercury-compiler-0.10.1/trace/mercury_trace.c:194: \
>     undefined reference to `MR_COLLECT_filter'
> 
> What's strange is that as far as I can tell the function *is* defined.
> From mercury_trace.c:
> 
>   #include "mercury_trace.h"
>   #include "mercury_trace_internal.h"
>   #include "mercury_trace_external.h"
> 
> From mercury_trace_external.h:
> 
>   extern void     MR_COLLECT_filter(MR_FilterFuncPtr filter_ptr, \
>       MR_Unsigned seqno, 
>                 MR_Unsigned depth, MR_Trace_Port port, 
>                 const MR_Label_Layout *layout, const char *path, 
>                 bool *stop_collecting);
> 
> And the function seems to be defined in mercury_trace_external.c.
> Furthermore, the code I have is supposed to be a "release" version, it
> has definitely been tested on Linux, and I am using the recommended
> version of GCC (2.95.x is the recommendation, I have 2.95.2).
> 
> Short of learning C, which I'd like to do at some point but don't have
> time for right now, can anybody suggest what to do/how to troubleshoot
> this?
> 
> Thanks for your suggestions.
>                                                                         
> -- 
> Matt Gushee
> Englewood, Colorado, USA
> mgushee at havenrock.com
> http://www.havenrock.com/
> _______________________________________________
> CLUE-Tech mailing list
> CLUE-Tech at clue.denver.co.us
> http://clue.denver.co.us/mailman/listinfo/clue-tech


=====
Keith E. Hellman
kehellman at yahoo.com

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the clue-tech mailing list