Why do I get "Undefined Reference to..." errors?

Previous The C Language Next

Q: When I tried to compile my program, the linker reports to me
Undefined reference to ...
although my program seems correct. What's a problem?
A: Either something is wrong with your program (more probably you used a function which is not defined elsewhere, maybe due to typing error), or you used something which is not yet implemented yet in GCC4TI (which is probably true if you got an undefined reference to a symbol which begins which the double underscore '__'). For example, although GCC4TI supports very long (64-bit) integers ('long long' type, which is a GNU C extension), the support for multiplying and dividing double longs is not supported yet. For example, if you try to divide two double-long numbers, you will get an undefined reference to '__udivdi3'. Sorry, there is no simple help for this. You must live without 64-bit division for now. It may be implemented in the future.