Well I finally got the Header file in the compiler and was able to get it to see it but I got this error message when doing the Hello world lesson to test it out.
#include"../../std_lib_facilities.h"
int main ();
{ <-----//ERROR:expected a declaration
cout<<"Hello,World.\n";
return 0
}
when I ran it anyway a full page of errors for the std_lib_facilities.h file came up....I know im a pain in the rear but im not a quitter! I went back to Bajarne Stroustrup's site and he had updated his suggested compiler from the 2005 edition (which doesn't exist on the site any more) to the 2010 edition and that's the one I got do you think the std_lib_file won't work with the new edition?
removing the semicolon from the main function, it moved the error to the closing bracket so I added one after return 0 and that fixed those errors, (Thank you )but this is what comes up when I run it. See the problem?
1>------ Build started: Project: hello world, Configuration: Debug Win32 ------
1> hello world.cpp
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(71): error C2868: 'std::vector<_Ty,_Ax>::size_type' : illegal syntax for using-declaration; expected qualified-name
1> c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(95) : see reference to class template instantiation 'Vector<T>' being compiled
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(71): error C2143: syntax error : missing ';' before '='
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(71): error C2238: unexpected token(s) preceding ';'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(80): error C2061: syntax error : identifier 'initializer_list'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(80): error C2535: 'Vector<T>::Vector(void)' : member function already defined or declared
1> c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(75) : see declaration of 'Vector<T>::Vector'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(102): error C2868: 'std::basic_string<_Elem,_Traits,_Ax>::size_type' : illegal syntax for using-declaration; expected qualified-name
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(102): error C2143: syntax error : missing ';' before '='
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(102): error C2238: unexpected token(s) preceding ';'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(213): error C2143: syntax error : missing ';' before '{'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(213): error C2275: 'std::tr1::uniform_int_distribution<>' : illegal use of this type as an expression
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(213): error C2143: syntax error : missing ';' before '}'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(222): error C2988: unrecognizable template declaration/definition
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(222): error C2059: syntax error : 'using'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(243): error C2143: syntax error : missing ';' before '<'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(243): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(243): error C2988: unrecognizable template declaration/definition
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(243): error C2059: syntax error : '<'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(251): error C2143: syntax error : missing ';' before '{'
1>c:\users\diana\documents\visual studio 2010\projects\std_lib_facilities.h(251): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
One thing which caught my eye is, there should be space between #include and the file name.
Can you please tell what does this library std_lib_facilities.h do? I have not used this library before. Looks like there are so many things in the header file which is not compiling, I would doubt if it is compatible , I will try using 2011 or 2013 visual studio just to be make sure it is fully compatible. Good luck.
I have been trying to get this file in my compiler program for over a month, with tons of help from here, Finally got it to work.
The tutorial for including this file said no spaces. I was finally able to get it there and for it to be recognized, you can't have any spaces for it to work.
removing the semicolon from the main function and adding it to the end of the return 0 solved those issue. I just wanted to know if there was a problem with the std_lib_facilities.h file, if code could become outdated and if by reading the above error messages you could tell if it was that code or something else im doing wrong.
Sure, there a collection of Header files that a teacher wrote to accompany his book, Programming, Principles and Practices using C++....by Bjarne Stroustrup.
I need these files to do the lessons in the book.
I don't know which version of that header you are using. i googled for the filename, the first version i found was 234 lines long. It gave many unpleasant-looking errors when i tried to compile with it.
Chervil, this is interesting. That was the file I was using ( I reloaded the above file from your link) im looking at your example the thing I see is your include line. The tutorial said to put the file in one of three places in the compiler program to get the compiler to see and use it: #include../../../"std_lib_facilities.h" the file shows up in a drop down menu as described in the tutorial. I tried it the way your example showed and it just doesn't want to see the file. Where exactly did you put the header file and how, to be able to use the include im seeing in your example?
Don't worry about my include line. I customised my IDE to search some user-specified location for header files. That allows me to put headers for global use in that directory.
Your own #include must have been perfectly ok, or the compiler would have halted with a "file not found" message.
However - I tried a different compiler and could not get it to work at all.
The one which worked for me was MinGW GCC 4.8.1 32-bit compiler.