[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: POTFILES, snprintf and key_helper compilation errors
From: |
David Philippi |
Subject: |
Re: POTFILES, snprintf and key_helper compilation errors |
Date: |
Mon, 9 Sep 2002 12:43:50 +0200 |
User-agent: |
KMail/1.4.1 |
On Monday 09 September 2002 03:16, Gervase Lam wrote:
> Managed to get rid of a few other compilation errors due to snprintf being
> used but not being declared (i.e. #include <stdio.h> is required) and
> key_helper.cxx being moved up one directory. The cvs diff file containing
> the changes are attached.
Such errors are unfortunate but may happen with different compiler versions.
The problem is - which headers to standard headers like <vector>,
<string>... include. If I use a version where e.g. <vector> includes
<stdio.h> I want get any error but if your version doesn't snprintf isn't
defined for you.
To your error message - let's take it piece for piece:
> `vector<Input::Button *, allocator<Input::Button *>
We have a vector<Input::Button*> and since no special allocator (= a class
which defines where vector should get it's memory from) is defined, the
default STL allocator is used which is a template itself getting the same
parameter as vector.
> >::_M_insert_aux(Input::Button **, Input::Button *const &)':
This is just an internal method of vector.
> /usr/include/g++-3/stl_algobase.h|149| undefined reference to
> `Input::KeyHelper::string_to_key(basic_string<char,
> string_char_traits<char>, __default_alloc_template<true, 0> > const &)'
Everything from basic_string on is just the full name of what is commonly
known as string. ;-)
In other words there is no STL string class. String is just a typedef which
defines a combination of some STL templates. If you do a using namespace std
you may change every usage of string to the text above, but I believe that
string is a bit more readable...
Undefined reference means that the compiler got a header which makes the code
itself defined but the linker couldn't find an implementation of the code.
This is a strong indicator of missing .o files or libraries.
> I must admit, I still don't know what the error messages EXACTLY mean. I
> understand the bit about the fact that button_factory.o (i.e
> button_factory.cxx) was trying to use KeyHelper::string_to_key() but it
> couldn't because it was not compiled. However, what does the "vector...",
Be carefull here - KeyHelper::string_to_key() may be compiled and you'd still
get the error if key_helper.o is not included in the final linking process.
> "include/new" and "g++-3/stl_algobase.h" bits mean?
Those are just headers of STL. Classes like vector, map... aren't implemented
in the compiler. They are completely normal classes which you could write
from scratch. The only difference is that your version is unlikely to be
bundeled with the compiler unless it complies to the specifications for the
STL and is better then the one used right now. ;-)
Bye David
- Prev by Date:
Re: [Pingus-CVS] CVS: Games/Pingus/src story.cxx,1.7,1.8 story.hxx,1.7,1.8
- Next by Date:
Re: [Pingus-CVS] CVS: Games/Pingus/src surface_button.cxx,1.12,1.13
- Previous by thread:
Re: POTFILES, snprintf and key_helper compilation errors
- Next by thread:
Re: [Pingus-CVS] CVS: Games/Pingus/src story.cxx,1.7,1.8 story.hxx,1.7,1.8
- Index(es):