I'm currently developing a program to scrape my university's online timetable system and then convert the resulting data to iCalendar data. It's a learning exercise for me(I'm teaching myself C++) and there's a few things that still get me.
I've been using XCode as my IDE for a while and it does a great job(for me) but because I'm sending my project to someone without a mac, I'm adding the option to use autotools. This is not a problem with autotools, this is a (possible) problem with the command-line arguments to pass to g++.
It's possible to build an XCode project from the command-line using xcodebuild and the nice thing that it does is it prints the commands being run to screen.
This is the command XCode runs to compile one of the files:

/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O3 -mdynamic-no-pic -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.5.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/Timetabler-generated-files.hmap -I/Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/Timetabler-own-target-headers.hmap -I/Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/Timetabler-all-target-headers.hmap -iquote /Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/Timetabler-project-headers.hmap -F/Users/r0ssar00/Development/Timetabler/build/Release -F/Developer/SDKs/MacOSX10.5.sdk/System/Library/PrivateFrameworks -iquotelibdatastore/include -iquotelibtimetable/include -iquotelibxml/include -I/Users/r0ssar00/Development/Timetabler/build/Release/include -I/Developer/SDKs/MacOSX10.5.sdk/usr/include -I/Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/DerivedSources -include /var/folders/8p/8pRP5fkbHluDRgn6yt2nL++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Prefix-fanhgwfoocngoifsbhuynqxkbqmf/Prefix.h -c /Users/r0ssar00/Development/Timetabler/frontends/src/TerminalFrontend.cpp -o /Users/r0ssar00/Development/Timetabler/build/Timetabler.build/Release/Timetabler.build/Objects-normal/i386/TerminalFrontend.o

This is the command that make runs to compile one of the files(TerminalFrontend.cpp)

g++ -DHAVE_CONFIG_H -I. -I../..  -I/usr/include/   -g -O2 -MT Timetabler-TerminalFrontend.o -MD -MP -MF .deps/Timetabler-TerminalFrontend.Tpo -c -o Timetabler-TerminalFrontend.o `test -f 'TerminalFrontend.cpp' || echo './'`TerminalFrontend.cpp

and the resulting errors

../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/../../libtimetable/include/Course.h:26: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/../../libtimetable/include/Course.h:26: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/../../libtimetable/include/Course.h:37: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/../../libtimetable/include/Course.h:37: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/Timetable.h:40: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/Timetable.h:40: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/Timetable.h:47: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/Timetable.h:47: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:40: error: ‘list’ has not been declared
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:40: error: expected ‘,’ or ‘...’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:43: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:43: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:54: error: ISO C++ forbids declaration of ‘list’ with no type
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:54: error: expected ‘;’ before ‘<’ token
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h: In member function ‘bool DataStore::ReadFile(std::string)’:
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:30: error: ‘datastore’ was not declared in this scope
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h: In member function ‘void DataStore::SetData(int)’:
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:41: error: ‘datastore’ was not declared in this scope
../../frontends/include/../../frontends/include/../../libdatastore/include/DataStore.h:41: error: ‘Data’ was not declared in this scope
TerminalFrontend.cpp: In member function ‘virtual bool TerminalFrontend::ReadData(DataStore*)’:
TerminalFrontend.cpp:93: error: ‘class Timetable’ has no member named ‘Get’
make: *** [Timetabler-TerminalFrontend.o] Error 1

I think that there's a flag in the XCode version that I might be missing in the make version but I don't know which one it is.
Anyone have any ideas?

Recommended Answers

All 2 Replies

Assuming that the FIRST warning/error from g++ is

./../frontends/include/../../frontends/include/../../libdatastore/include/../../libtimetable/include/../../libtimetable/include/Course.h:26: error: ISO C++ forbids declaration of ‘list’ with no type

Then you error is going to be that from gcc-4.0 and onwards, namespace std is not included in the files like list etc.

ie. You write this

#include <list>

class A
{
   private:

    list<int> Items;
  // other stuff
};

and it is going to fail.

you have two quick options write using namespace std; or change the code to std::list<inst> .

I strongly advocate the latter but if your pushed for time try the first.

NOTE: If you add using namespace std; be very careful that you don't do this:

#include <list>
#include "MyClass.h"

using namespace std;

// other stuff.

Note that the using namespace std, needs to be about the include files or in the include files.

That was it, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.