473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

'ptrdiff_t' has not been declared

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
6 13981
"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
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
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: PengYu.UT | last post by:
I'm wondering when I should use ptrdiff_t and size_t instead of int and unsigned int or long and unsigned long? Is there any guideline I should follow? Peng
9
by: PengYu.UT | last post by:
std::size_t and std::ptrdiff_t are defined in <cstddef>. I've noticed that a bunch of old math function in the global namespace are undefined in <cmath> and they are redefined in std namespace. ...
2
by: alberto | last post by:
I am learning STL with the book STL Tutorial and Reference guide (1 edition), the following example don't run : int main() { // Initialize array a with 10 integers: int a = {12, 3, 25, 7, 11,...
26
by: robertwessel2 | last post by:
In another thread, a poster mentioned the Posix ssize_t definition (signed version of size_t). My initial reaction was to wonder what the point of the Posix definition was when ptrdiff_t was...
10
by: kyagrd | last post by:
<code> #include <iostream> int main(void) { using namespace std; int p; int* p1 = p; int* p11 = p + 2;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.