Multiple definition of inline functions when linking static libs

First you have to understand the C99 inline model – perhaps there is something wrong with your headers. There are two kind of definitions for inline functions with external (non-static) linkage External definition This definition of a function can only appear once in the whole program, in a designated TU. It provides an exported function … Read more

undefined reference to `strlwr’

strlwr() is not standard C function. Probably it’s provided by one implementation while the other compiler you use don’t. You can easily implement it yourself: #include <string.h> #include<ctype.h> char *strlwr(char *str) { unsigned char *p = (unsigned char *)str; while (*p) { *p = tolower((unsigned char)*p); p++; } return str; }

Error when compiling some simple c++ code

Normally this sort of failure happens when compiling your C++ code by invoking the C front-end. The gcc you execute understands and compiles the file as C++, but doesn’t link it with the C++ libraries. Example: $ gcc example.cpp Undefined symbols for architecture x86_64: “std::cout”, referenced from: _main in ccLTUBHJ.o “std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> … Read more

C error: undefined reference to function, but it IS defined

How are you doing the compiling and linking? You’ll need to specify both files, something like: gcc testpoint.c point.c …so that it knows to link the functions from both together. With the code as it’s written right now, however, you’ll then run into the opposite problem: multiple definitions of main. You’ll need/want to eliminate one … Read more