By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

'ptrdiff_t' has not been declared

P: n/a
I'm getting the following error, and from 40 to 300 similar error when
I try to compile on mac os x.

I believe that it has something to do with STL, because this error
occures when I try to include any STL files, like list in this
example.

Please help me.

c++ code:
#include <cstddef>
#include <cstdlib>
#include <list>

int main()
{
return EXIT_SUCCESS;
}

Compile command (from xcode):
/usr/bin/gcc-4.0 -x c++ -arch i386 -pipe -Wno-trigraphs -fasm-
blocks -g -O0 -fmessage-length=0 -mfix-and-continue -mmacosx-version-
min=10.4 -fvisibility-inlines-hidden -I/Users/thomas/Development/xcode/
mwcd_development/build/mwcd_development.build/Debug/Tester.build/
Tester.hmap -F/Users/thomas/Development/xcode/mwcd_development/build/
Debug -I/Users/thomas/Development/xcode/mwcd_development/build/Debug/
include -I/Users/thomas/Development/xcode/mwcd_development/build/
mwcd_development.build/Debug/Tester.build/DerivedSources -isysroot /
Developer/SDKs/MacOSX10.4u.sdk -c /Users/thomas/Development/xcode/
mwcd_development/tester_a.cpp -o /Users/thomas/Development/xcode/
mwcd_development/build/mwcd_development.build/Debug/Tester.build/
Objects-normal/i386/tester_a.o

Output:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/cstddef:52:
error: '::ptrdiff_t' has not been declared
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/cstddef:53:
error: '::size_t' has not been declared
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/postypes.h:
78: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:104: error: expected type-specifier before
'ptrdiff_t'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:104: error: expected `>' before 'ptrdiff_t'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:115: error: '_Pointer' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:117: error: '_Reference' does not name a
type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:141: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:151: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator.h:95: error: wrong number of template arguments (5,
should be 3)
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:106: error: provided for 'template<class
_Category, class _Tp, class _Distancestruct std::iterator'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator.h:337: error: wrong number of template arguments (5,
should be 3)
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:106: error: provided for 'template<class
_Category, class _Tp, class _Distancestruct std::iterator'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator.h:412: error: wrong number of template arguments (5,
should be 3)
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:106: error: provided for 'template<class
_Category, class _Tp, class _Distancestruct std::iterator'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator.h:490: error: wrong number of template arguments (5,
should be 3)
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_iterator_base_types.h:106: error: provided for 'template<class
_Category, class _Tp, class _Distancestruct std::iterator'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_algobase.h: In static member function 'static _Tp*
std::__copy_backward<true,
std::random_access_iterator_tag>::copy_b(const _Tp*, const _Tp*,
_Tp*)':
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_algobase.h:424: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/
stl_algobase.h:425: error: '_Num' was not declared in this scope
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new: At global
scope:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:84: error:
declaration of 'operator new' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:84: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:85: error:
declaration of 'operator new []' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:85: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:88: error:
declaration of 'operator new' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:88: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:88: error:
expected primary-expression before 'const'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:89: error:
declaration of 'operator new []' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:89: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:89: error:
expected primary-expression before 'const'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:94: error:
declaration of 'operator new' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:94: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:94: error:
expected primary-expression before 'void'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:95: error:
declaration of 'operator new []' as non-function
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:95: error:
'size_t' is not a member of 'std'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/new:95: error:
expected primary-expression before 'void'
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/ext/
new_allocator.h:54: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/allocator.h:
65: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/allocator.h:
86: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_list.h:
116: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_list.h:
193: error: 'ptrdiff_t' does not name a type
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/bits/stl_list.h:
409: error: 'ptrdiff_t' does not name a type

Jun 15 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"jubelbrus" writes:
I'm getting the following error, and from 40 to 300 similar error when
I try to compile on mac os x.

I believe that it has something to do with STL, because this error
occures when I try to include any STL files, like list in this
example.

Please help me.

c++ code:
#include <cstddef>
#include <cstdlib>
#include <list>

int main()
{
return EXIT_SUCCESS;
I would start by changing that to std::EXIT_SUCCESS;
}

Jun 15 '07 #2

P: n/a
jubelbrus wrote:
[..]
Compile command (from xcode):
/usr/bin/gcc-4.0 -x c++ [..]

Output:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/cstddef:52:
error: '::ptrdiff_t' has not been declared
[..]
Ask in a gnu newsgroup, they apparently have something to do with it;
your code compiles fine on my system (as it should).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 15 '07 #3

P: n/a
osmium wrote:
"jubelbrus" writes:
>I'm getting the following error, and from 40 to 300 similar error
when I try to compile on mac os x.

I believe that it has something to do with STL, because this error
occures when I try to include any STL files, like list in this
example.

Please help me.

c++ code:
#include <cstddef>
#include <cstdlib>
#include <list>

int main()
{
return EXIT_SUCCESS;

I would start by changing that to std::EXIT_SUCCESS;
Really? How does putting "std::" in front of a macro help? It's
similar to writing "std::NULL", do you use that as well? I am
genuinely curious, maybe I am missing something obvious in my work.

Thanks!
>}
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 15 '07 #4

P: n/a
"Victor Bazarov" writes:
osmium wrote:
>> return EXIT_SUCCESS;

I would start by changing that to std::EXIT_SUCCESS;

Really? How does putting "std::" in front of a macro help? It's
similar to writing "std::NULL", do you use that as well? I am
genuinely curious, maybe I am missing something obvious in my work.
I think I messed up. What's your guess?
Jun 15 '07 #5

P: n/a
osmium wrote:
"Victor Bazarov" writes:
>osmium wrote:
>>> return EXIT_SUCCESS;

I would start by changing that to std::EXIT_SUCCESS;

Really? How does putting "std::" in front of a macro help? It's
similar to writing "std::NULL", do you use that as well? I am
genuinely curious, maybe I am missing something obvious in my work.

I think I messed up. What's your guess?
No guesses here, I was just asking.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 15 '07 #6

P: n/a
On 15 Jun, 15:12, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
osmium wrote:
"Victor Bazarov" writes:
osmium wrote:
return EXIT_SUCCESS;
>I would start by changing that to std::EXIT_SUCCESS;
Really? How does putting "std::" in front of a macro help? It's
similar to writing "std::NULL", do you use that as well? I am
genuinely curious, maybe I am missing something obvious in my work.
I think I messed up. What's your guess?

No guesses here, I was just asking.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Found the problem. Had something to with the setup of the build in
xcode.
Removed "Always search user paths", and like magic, everything worked.

By the way, thanks for all the replies

Jun 16 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.