How to improve my question?

5 Antworten [Letzter Beitrag]
Mr_Robot
Offline
Beigetreten: 08/15/2015

How to test from Debian GNU/Linux using g++?

I trying compile an example of a book.

The program use three classes: Book, Customer and Library.

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
^~~~~
compilation terminated.

This example was tested from another compiler. The library is not recognized.

The book is C++17 By Example, published by Packt.

My question was closed!

AnhangGröße
Captura de pantalla_2021-07-30_11-27-12.png27.45 KB
Magic Banana

I am a member!

I am a translator!

Online
Beigetreten: 07/24/2010

Can you attach/link to the source code you try to compile?

Mr_Robot
Offline
Beigetreten: 08/15/2015

Attach the source code here!

AnhangGröße
source.tar.gz 1.84 KB
Magic Banana

I am a member!

I am a translator!

Online
Beigetreten: 07/24/2010

At first, I imagined that the differences were due to the authors using Microsoft Visual C++ that would be more permissive (I actually have no idea): it would somehow automatically "#include <string>", "#include <list>", #include <fstream> and be "using namespace std;" at the beginning of book.h, add a semicolon at its end, etc. However, there are also typos such as "book" instead of bool" in customer.h, supernumerary quotes at the beginning of the output stream operator for a Book and that operator uses class variables (m_borrowed, m_reservationList and m_customerId) that are not declared.

I would stay away from that content (unless you are responsible for introducing the typos, for mixing different version of files, etc.).

Mr_Robot
Offline
Beigetreten: 08/15/2015

But, how to improve my question?.

Captura de pantalla_2021-08-05_10-04-33.png
Magic Banana

I am a member!

I am a translator!

Online
Beigetreten: 07/24/2010

You have not linked to the question you asked. Anyway, you should properly describe the steps you followed (without digressions) and precede the commands with "LC_ALL=C " (without the quotes) to have them output messages in English.