sudham / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Link errors when trying to build a program using ticpp (not as library) #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. take the code in http://code.google.com/p/ticpp/wiki/BeginersExample , 
include the line 
#define TIXML_USE_TICPP
at the top
2. compile -> ok
3. link -> errors

What is the expected output? What do you see instead?

Expected: successful linking.
Instead: many linker errors of the kind
Undefined symbols:
  "TiXmlString::npos", referenced from:
      TiXmlAttribute::Print(__sFILE*, int, TiXmlString*) constin tinyxml.o
      TiXmlString::find(char, unsigned long) constin tinyxml.o
      TiXmlString::find(char, unsigned long) constin tinyxml.o
etc.

What version of the product are you using? On what operating system?

2.5.3 on OSX 10.6, XCode 3.2.6 (GCC 4.2.1)

Please provide any additional information below.

A workaround I found: add the lines

#ifndef TIXML_USE_TICPP
    #define TIXML_USE_TICPP
#endif

at the top of tinyxml.h and ticpp.cpp.
The problem is apparently that when ticpp.cpp is compiled, TIXML_USE_TICPP is 
not defined yet (because no header file is included before line 24) and thus 
the code following the
#ifdef TIXML_USE_TICPP
in line 24 is excluded.

Original issue reported on code.google.com by bernhard...@gmail.com on 19 Dec 2011 at 9:30