C++ Templates and symbols not defined in .o files

Wesley Smith wesley.hoke@gmail.com
Thu Sep 23 13:28:00 GMT 2010

I ended up doing a process of elimination that come down to changing:

int idx = MAX(0, MIN(lua::opt<int>(L, 2, 0), SLAB_MAX_RENDER_TARGETS));


int idx = MAX(0, lua::opt<int>(L, 2, 0));

I'm trying to revert right now to get it to work.  Will post back when
I'm done.  In particular, there were a few definitions of MIN floating
around and I want to track down exactly which one was used.


On Mon, Sep 20, 2010 at 1:57 PM, Ian Lance Taylor <iant@google.com> wrote:
> Wesley Smith <wesley.hoke@gmail.com> writes:
>> The problem is that when I go to use it in a .cpp file, the symbol for
>> this function is U (undefined) instead of W (weak) as it should be.
>> For example, I have a couple of .cpp files that use the exact same
>> code, just changing the class T the template is based on.  In all but
>> 1 of the .o files resulting, the symbol is W.  What's strange is that
>> I'm compiling these files with exactly the same flags.
> Can you show us a standalone test case?
> Ian

More information about the Gcc-help mailing list