William Torrez Corea writes:
Book.cpp:1:10: fatal error: Set: No existe el fichero o el directorio [closed]I trying compile an example of a book. The program use three classes: Book, Customer and Library.
The question is offtopic for debian-user, how did it get here? Also, how are subject and content related?When giving the source code, give it in entirety, i.e. including the missing "customer.h", "library.h" and others. Also, for such long source codes, it seems preferrable to provide them as an attachment rather than inline.
Book.cpp #include <set>
[...]
When i compile the example with the following command: g++ -g -Wall Book.cpp book.h -o book The result expected is bad. Book.cpp:1:10: fatal error: Set: No existe el fichero o el directorio #include <Set> ^~~~~ compilation terminated.
[...]
The book is C++17 By Example, published by Packt.
[...]The immediate problem is with the case "Set" vs. "set". In your source code above you correctly have `#include <set>`, but the error message suggests that the `Book.cpp` you are trying to compile still has `#include <Set>` as displayed by the compiler.
In fact, this seems to be a known erratum for the book sample codes: https://github.com/PacktPublishing/CPP17-By-Example/issues/1Clone the repository to get the entire sample source code. I could get to compile the `Chapter04` example by making changes as attached in `patchbook.patch`. Apply it with
patch --strip 1 < patchbook.patch from inside the repository. HTH Linux-Fan öö
diff --git a/Chapter04/LibraryPointer/Book.cpp b/Chapter04/LibraryPointer/Book.cpp index ae86fd2..62f60f5 100644 --- a/Chapter04/LibraryPointer/Book.cpp +++ b/Chapter04/LibraryPointer/Book.cpp @@ -1,9 +1,9 @@ -#include <Set> -#include <Map> -#include <List> -#include <String> -#include <FStream> -#include <Algorithm> +#include <set> +#include <map> +#include <list> +#include <string> +#include <fstream> +#include <algorithm> using namespace std; #include "Book.h" @@ -84,4 +84,4 @@ ostream& operator<<(ostream& outStream, const Book& book) { } return outStream; -} \ No newline at end of file +} diff --git a/Chapter04/LibraryPointer/Customer.cpp b/Chapter04/LibraryPointer/Customer.cpp index ac17964..31ffe1d 100644 --- a/Chapter04/LibraryPointer/Customer.cpp +++ b/Chapter04/LibraryPointer/Customer.cpp @@ -1,8 +1,8 @@ -#include <Set> -#include <Map> -#include <List> -#include <String> -#include <FStream> +#include <set> +#include <map> +#include <list> +#include <string> +#include <fstream> using namespace std; #include "Book.h" @@ -87,4 +87,4 @@ ostream& operator<<(ostream& outStream, const Customer& customer){ } return outStream; -} \ No newline at end of file +} diff --git a/Chapter04/LibraryPointer/Library.cpp b/Chapter04/LibraryPointer/Library.cpp index 10b4ac4..2c6f1a7 100644 --- a/Chapter04/LibraryPointer/Library.cpp +++ b/Chapter04/LibraryPointer/Library.cpp @@ -1,10 +1,10 @@ -#include <Set> -#include <Map> -#include <List> -#include <String> -#include <FStream> -#include <IOStream> -#include <CAssert> +#include <set> +#include <map> +#include <list> +#include <string> +#include <fstream> +#include <iostream> +#include <cassert> using namespace std; #include "Book.h" @@ -611,4 +611,4 @@ Library::~Library() { for (const Customer* customerPtr : m_customerPtrList) { delete customerPtr; } -} \ No newline at end of file +} diff --git a/Chapter04/LibraryPointer/Main.cpp b/Chapter04/LibraryPointer/Main.cpp index 18d1637..586b47e 100644 --- a/Chapter04/LibraryPointer/Main.cpp +++ b/Chapter04/LibraryPointer/Main.cpp @@ -1,15 +1,16 @@ -#include <Set> -#include <Map> -#include <List> -#include <String> -#include <FStream> -#include <IOStream> +#include <set> +#include <map> +#include <list> +#include <string> +#include <fstream> +#include <iostream> using namespace std; #include "Book.h" #include "Customer.h" #include "Library.h" -void main() { +int main() { Library(); -} \ No newline at end of file + return 0; +}
pgpUlyJNnqpAw.pgp
Description: PGP signature