PacktPublishing / Modern-CPP-Programming-Cookbook-Second-Edition

Modern C++ Programming Cookbook, Second Edition, published by Packt
MIT License
186 stars 70 forks source link

Chapter 12 Example 05 Compile Errors #1

Open SSJUSA opened 3 years ago

SSJUSA commented 3 years ago

Dear Author,

I bought your second edition Modern C++ book on Amazon.com in the United States.

I am using the gcc g++ 10.1.0 compiler on Windows 10 laptop with Cygwin terminal window.

While compiling chapter 12 example 12_05, with #define USE_RANGES_V3 getting following compile errors

$ g++-10.1.0 -Wall -std=c++20 main.cpp -o main.exe In file included from /usr/local/include/c++/10.1.0/range/v3/view.hpp:17, from main.cpp:10: /usr/local/include/c++/10.1.0/range/v3/view/adaptor.hpp:18:10: fatal error: concepts/concepts.hpp: No such file or directory 18 | #include <concepts/concepts.hpp> | ^~~~~~~ compilation terminated.

ssjus@LAPTOP-DK5PVG34 ~/CPP/Modern_CPP_Ed2_Ck_Bk_SSJ/Ch_12/chapter12_05

I have a file with name: concepts (i.e. without .hpp extension) include file in the following folder:

C:\cygwin64\usr\local\include\c++\10.1.0

I have a concepts.hpp file in each of the following folders:

C:\cygwin64\usr\local\include\c++\10.1.0\range\v3\action C:\cygwin64\usr\local\include\c++\10.1.0\range\v3\functional C:\cygwin64\usr\local\include\c++\10.1.0\range\v3\iterator C:\cygwin64\usr\local\include\c++\10.1.0\range\v3\range C:\cygwin64\usr\local\include\c++\10.1.0\range\v3\utility

File sizes in each of these folders are different.

12_05 example is compiling without errors, if I don't define USE_RANGES_V3

But I need also to compile without errors when I use #define USE_RANGES_V3

Please let me know how to fix the above compile errors.

Thanks and best regards, SSJ

mariusbancila commented 3 years ago

I don't know about Cygwin, I never used that. But you can always try these samples with wandbox.org or godbolt.org.

Here is a sample of of chapter12_05 using ranges v3 on wandbox.

https://wandbox.org/permlink/OyvrBVMl5BuxDMSF