I am getting pretty frustrated, I cannot for the life of me figure out why I am getting the errors that I am. The program I need to write is for my class, we had just gone over using structs in class and the program needs to use a couple of structs to create a sort of phonebook.
I have included the files that I have for the program
the way the main program is now I get the following error when i compile using the command
g++ -o phonebook_main.cpp
phonebook.h:18: error: ISO C++ forbids declaration of 'vector' with no type
phonebook.h:18: error: invalid use of '::'
phonebook.h:18: error: expected ';' before '<' token
phonebook_main.cpp: In function 'int main(int, char**)':
phonebook_main.cpp:56: error: 'struct Phonebook' has no member named '_entries'
phonebook_main.cpp:71: error: 'struct Phonebook' has no member named '_entries'
but if I alter the #includes in the main file to this
#include "phonebook.h"
#include <iostream>
#include <string>
This is the way the main program was given to us, so it will probably need to work with the includes ordered this way.
I get these errors
phonebook.h:11: error: 'string' in namespace 'std' does not name a type
phonebook.h:17: error: 'string' in namespace 'std' does not name a type
phonebook.h:18: error: ISO C++ forbids declaration of 'vector' with no type
phonebook.h:18: error: invalid use of '::'
phonebook.h:18: error: expected ';' before '<' token
phonebook.h:24: error: expected unqualified-id before '&' token
phonebook.h:24: error: expected ',' or '...' before '&' token
phonebook.h:24: error: ISO C++ forbids declaration of 'parameter' with no type
phonebook.h:26: error: expected unqualified-id before '&' token
phonebook.h:26: error: expected ',' or '...' before '&' token
phonebook.h:26: error: ISO C++ forbids declaration of 'parameter' with no type
phonebook_main.cpp: In function 'int main(int, char**)':
phonebook_main.cpp:30: error: 'struct Phonebook' has no member named '_file_name'
phonebook_main.cpp:51: error: cannot convert 'std::string' to 'int' for argument '2' to 'int lookup_name(const Phonebook&, int)'
phonebook_main.cpp:57: error: 'struct Phonebook' has no member named '_entries'
phonebook_main.cpp:72: error: 'struct Phonebook' has no member named '_entries'
phonebook_main.cpp:84: error: cannot convert 'std::string' to 'int' for argument '2' to 'void add_to_lists(Phonebook&, int)'
Any help would be greatly appreciated, on a side note, the functions file that I wrote compiles fine with the header file. I am assuming I messed up something in my header file because the file he provided worked for everyone else in the class.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.