Cannot compile C++ project in xcode

Hello

I have a C++ command line project that I am trying to get to compile with xcode. its made of 5 .cpp files and 4 header files. I can get it to compile using my Makefile with no errors, but I would rather not have to use a terminal window every time I need to check how I'm doing. when I try to build it with xcode, I get 90 errors, such as error: forward declaration of 'struct rm'. all the errors are in libraries that I did not create, so I am thinking it has to do with the settings I am using. I created the project with c++ tool, but I do not know what else to try, and a search yielded no help.
I would appreciate any help.

thanks

Macbook 1.83ghz Core Duo, Mac OS X (10.5.1)

Posted on Jan 31, 2008 11:53 AM

Reply
4 replies

Jan 31, 2008 2:12 PM in response to Dak

What does your makefile look like? I suspect you are using gcc to compile the files and it is compiling them as C file. Xcode is using g++ and complaining about syntax. Go ahead and post some of the code that it is complaining about too. Put your code between two lines of
{ code }
{ code }
without the spaces and it will format nicely.

Feb 1, 2008 1:29 AM in response to etresoft

im using g++ in my makefile. when I use the makefile, there are not any errors, and it compiles and runs fine. however, when I use xcode's build, I get the errors. none of the errors are in files that I have created, but are in locale_faucets.tcc, ctime, or wchar.h. none of the errors are stuff that I wrote, which is why I did not post the code. this is one of the sections that it is complaining about, however from locale_facuets.tcc:
{ code }
case 'X':
// Locale's time.
const char_type* __times[2];
_tp._M_time_formats(_times);
__beg = M_extract_via_format(_beg, __end, __io, __err,
__tm, __times[0]);
break;
case 'y':
case 'C': // C99
// Two digit year. [tm_year]
__beg = M_extract_num(_beg, __end, _tm->tmyear, 0, 99, 2,
__io, __err);
break;
case 'Y':
// Year [1900). [tm_year]
__beg = M_extract_num(_beg, __end, __mem, 0, 9999, 4,
__io, __err);
if (!__err)
_tm->tmyear = __mem - 1900;
break;
case 'Z':
// Timezone info.
if ( _ctype.is(ctypebase::upper, *__beg))
{
int __tmp;
__beg = M_extract_name(_beg, __end, __tmp,
_timepunct_cache<_CharT>::_Stimezones,
14, __io, __err);


{ code }

this file is easily 2000 lines long, and has stuff that I have never seen, nor do I understand it. I would appreciate any help.
thanks

Feb 1, 2008 4:31 AM in response to Dak

Dak wrote:
im using g++ in my makefile. when I use the makefile, there are not any errors, and it compiles and runs fine. however, when I use xcode's build, I get the errors. none of the errors are in files that I have created, but are in locale_faucets.tcc, ctime, or wchar.h. none of the errors are stuff that I wrote, which is why I did not post the code. this is one of the sections that it is complaining about, however from locale_facuets.tcc:


Post the CC line from your makefile or, even better, the echo from when it is running with all the g++ arguments. Then, compare that to the same thing in Xcode. Also, what is your deployment target in Xcode?

{ code }
{ code }


Don't forget, no spaces 🙂

this file is easily 2000 lines long, and has stuff that I have never seen, nor do I understand it. I would appreciate any help.


It sounds like the king of thing one gets with code designed to run on several different platforms with lots of #defines. I used to get similar messages when I was working on porting STLport to MacOS X.

What do your #include's look like? Are you using the old-style .h includes for the C++ headers?

Feb 12, 2008 4:17 PM in response to etresoft

here is what is displayed when I run my makefile in terminal:

make
g++ -ansi -Wall -g -c appointment.cpp
g++ -ansi -Wall -g -c calendar.cpp
g++ -ansi -Wall -g -c day.cpp
g++ -ansi -Wall -g -c time.cpp
g++ -ansi -Wall -g -c year.cpp
g++ -ansi -Wall -g -o calendar.out appointment.o calendar.o day.o time.o year.o


with the exact same code using build in xcode, I get this from the results:

Building target “calendar” of project “calendar” with configuration “Debug” — (90 errors)
cd /Users/kiem/Downloads/hw3/calendar
/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -DGLIBCXXDEBUG=1 -DGLIBCXX_DEBUGPEDANTIC=1 -fmessage-length=0 -fvisibility-inlines-hidden -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -I/Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/calendar.hmap -F/Users/kiem/Downloads/hw3/calendar/build/Debug -I/Users/kiem/Downloads/hw3/calendar/build/Debug/include -I/Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.5.sdk -c /Users/kiem/Downloads/hw3/calendar/calendar.cpp -o /Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/Objects-normal/i386/calendar.o
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error: '::clock_t' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error: '::tm' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:70: error: '::clock' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:71: error: '::difftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:72: error: '::mktime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:73: error: '::time' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:74: error: '::asctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:75: error: '::ctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:76: error: '::gmtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:77: error: '::localtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:78: error: '::strftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function '_InIter std::timeget<CharT, InIter>::_M_extract_via_format(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*, const _CharT*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1794: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1801: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1809: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1816: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1828: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1835: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1838: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1850: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1855: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1863: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1867: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1887: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1923: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1931: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_weekday(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2157: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_monthname(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2203: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_year(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2230: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error: '::clock_t' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error: '::tm' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:70: error: '::clock' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:71: error: '::difftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:72: error: '::mktime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:73: error: '::time' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:74: error: '::asctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:75: error: '::ctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:76: error: '::gmtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:77: error: '::localtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:78: error: '::strftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1794: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1801: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1809: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1816: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1828: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1835: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1838: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1850: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1855: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1863: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1867: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1887: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1923: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1931: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2157: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2203: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2230: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
cd /Users/kiem/Downloads/hw3/calendar
/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -DGLIBCXXDEBUG=1 -DGLIBCXX_DEBUGPEDANTIC=1 -fmessage-length=0 -fvisibility-inlines-hidden -mfix-and-continue -mmacosx-version-min=10.5 -gdwarf-2 -I/Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/calendar.hmap -F/Users/kiem/Downloads/hw3/calendar/build/Debug -I/Users/kiem/Downloads/hw3/calendar/build/Debug/include -I/Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.5.sdk -c /Users/kiem/Downloads/hw3/calendar/appointment.cpp -o /Users/kiem/Downloads/hw3/calendar/build/calendar.build/Debug/calendar.build/Objects-normal/i386/appointment.o
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error: '::clock_t' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error: '::tm' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:70: error: '::clock' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:71: error: '::difftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:72: error: '::mktime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:73: error: '::time' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:74: error: '::asctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:75: error: '::ctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:76: error: '::gmtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:77: error: '::localtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:78: error: '::strftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function '_InIter std::timeget<CharT, InIter>::_M_extract_via_format(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*, const _CharT*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1794: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1801: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1809: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1816: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1828: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1835: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1838: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1850: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1855: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1863: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1867: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1887: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1923: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1931: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_weekday(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2157: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_monthname(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2203: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc: In member function 'virtual _InIter std::timeget<CharT, InIter>::do_get_year(InIter, _InIter, std::ios_base&, std::IosIostate&, tm*) const':
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2230: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error: '::clock_t' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error: '::tm' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:70: error: '::clock' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:71: error: '::difftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:72: error: '::mktime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:73: error: '::time' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:74: error: '::asctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:75: error: '::ctime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:76: error: '::gmtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:77: error: '::localtime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:78: error: '::strftime' has not been declared
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1794: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1801: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1809: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1816: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1828: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1835: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1838: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1850: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1855: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1863: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1867: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1887: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1923: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1931: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2157: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2203: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2230: error: invalid use of undefined type 'struct tm'
/Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward declaration of 'struct tm'
Build failed (90 errors)


for the #includes, here's an example of one of my header files:

#ifndef APPOINTMENT_H
#define APPOINTMENT_H
#include "time.h"
#include <cstring>
#include <iostream>
using namespace std;
class Appointment
{
public:
Appointment();
Appointment(Time s, Time e, char *sub, char *loc);
Appointment& operator=(Appointment& rhs)
{
start = rhs.start;
endt = rhs.endt;
subject = new char[strlen(rhs.subject)+1];
location = new char[strlen(rhs.location)+1];
strcpy(subject,rhs.subject);
strcpy(location,rhs.location);
return *this;
}
Time start, endt;
char *subject, *location;
void getAppt(char &str);
void addAppointment();
void editCsv(int &nmonth, int &nday, Appointment &nappt, char *amorpm[3]);
friend ostream& operator>>(ostream& outty, Time& t);
}; //class Appointment
#endif




the class I am in uses fedora computers and the program works fine there. I just want to be able to debug without having to ssh every time. also i can use a C command line tool without programs, if that helps.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Cannot compile C++ project in xcode

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.