Fehler in stddef.h ??

D

DickUndDa

Hi,

ich bekomme folgenden Fehler:
/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/stddef.h error: two or more data types in declaration of 'ptrdiff_t'

Wenn ich das folgende Programm kompiliere:

Ordnungsnummer.h
Code:
#ifndef ORDNUNGSNUMMER_H_
#define ORDNUNGSNUMMER_H_
class Ordnungsnummer
{
	public:
		/* Construcutr which initialises the private Variables _curYear,
		 * _curMonth and docNumber with the current Dates */
		Ordnungsnummer();
	
	private:
		int _curYear;
		int _curMonth;
		int _docNumber;
}
	
#endif /*ORDNUNGSNUMMER_H_*/

Ordnungsnummer.cpp:
Code:
#include "Ordnungsnummer.h"
#include <ctime>

Ordnungsnummer::Ordnungsnummer()
{
	
	const std::time_t unixTime = std::time(NULL);
	std::tm *localtime = std::localtime(&unixTime);
	_curYear = (*localtime).tm_year + 1900;
}

Das ganze in der Eclipse IDE. Ht jemand eine Idee was der Grund sein könnte?

Ach ja am Code dürft ihr auch rummeckern, bin Anfänger ;)
 
in der XCode Referenz stehts:
Code:
182. Ambiguous references to size_t

Section: 17 [lib.library]  Status: DR  Submitter: Al Stevens  Date: 15 Aug 1999

Many references to size_t throughout the document omit the std:: namespace qualification.

For example, 17.4.3.4 [lib.replacement.functions] paragraph 2:

— operator new(size_t)
— operator new(size_t, const std::nothrow_t&)
— operator new[](size_t)
— operator new[](size_t, const std::nothrow_t&)
Proposed resolution:

In 17.4.3.4 [lib.replacement.functions] paragraph 2: replace:

- operator new(size_t)
- operator new(size_t, const std::nothrow_t&)
- operator new[](size_t)
- operator new[](size_t, const std::nothrow_t&)

by:

- operator new(std::size_t)
- operator new(std::size_t, const std::nothrow_t&)
- operator new[](std::size_t)
- operator new[](std::size_t, const std::nothrow_t&)
In [lib.allocator.requirements] 20.1.5, paragraph 4: replace:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, size_t, and ptrdiff_t, respectively.

 by:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, std::size_t, and std::ptrdiff_t, respectively.

In [lib.allocator.members] 20.4.1.1, paragraphs 3 and 6: replace:

3 Notes: Uses ::operator new(size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

by:

3 Notes: Uses ::operator new(std::size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(std::size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

In [lib.char.traits.require] 21.1.1, paragraph 1: replace:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

by:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type std::size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

In [lib.char.traits.require] 21.1.1, table 37: replace the return type of X::length(p): "size_t" by "std::size_t".

In [lib.std.iterator.tags] 24.3.3, paragraph 2: replace:
    typedef ptrdiff_t difference_type;
by:
    typedef std::ptrdiff_t difference_type;

In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the declaration of template <class charT> class ctype.

In [lib.iterator.traits] 24.3.1, paragraph 2 put namespace std { ...} around the declaration of:

    template<class Iterator> struct iterator_traits
    template<class T> struct iterator_traits<T*>
    template<class T> struct iterator_traits<const T*>

Rationale:

The LWG believes correcting names like size_t and ptrdiff_t to std::size_t and std::ptrdiff_t to be essentially editorial. There there can't be another size_t or ptrdiff_t meant anyway because, according to 17.4.3.1.4 [lib.extern.types],

For each type T from the Standard C library, the types ::T and std::T are reserved to the implementation and, when defined, ::T shall be identical to std::T.
The issue is treated as a Defect Report to make explicit the Project Editor's authority to make this change.

[Post-Tokyo: Nico Josuttis provided the above wording at the request of the LWG.]

[Toronto: This is tangentially related to issue 229, but only tangentially: the intent of this issue is to address use of the name size_t in contexts outside of namespace std, such as in the description of ::operator new. The proposed changes should be reviewed to make sure they are correct.]

[pre-Copenhagen: Nico has reviewed the changes and believes them to be correct.]
 
Hi,

danke. Auch wenn ich noch nicht ganz durchblick - aber das wird noch ;)

Was mich interresiert ist, wie du das Ding gefunden hast. Mit keinem Begriff aus deinem Ausschnitt kann ich was finden. Oder ist das keine Volltextsuche in der Referenz?
 
arg. Ich habs gefunden, kurz und Bündig: Semikolon ist ne ****.

ich hab vergessen die Klasse mit einem Semikolon zu beenden.
 
Zurück
Oben Unten