alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.24k stars 325 forks source link

Build errors g++-10 / Link errors g++-11 #255

Closed cvanelteren closed 2 years ago

cvanelteren commented 2 years ago

Bug category

Describe the bug

Hi,

Firstly, thanks of all for this package. I am coming from matplotlib and this looks like a nice transition. I have some issues compiling code with this package however. Using g++-11 (gcc (GCC) 11.2.0) I am getting link errors and undefined symbols. The instructions clearly state that c++17 is supported, compiling with g++-10 yields compiling errors (see block below). Could you point me in the right direction? Thanks in advance! Steps to Reproduce

cd matplotplusplus/ && mkdir build && cd build
cmake .. && make -j 12 && make install .
 g++-10 ~/test.cpp -o test -I /usr/include -L /usr/lib 

where test.cpp is

#include <cmath>
#include <matplot/matplot.h>

int main() {
    using namespace matplot;
    show();
    return 0;
}

Output

```console In file included from /usr/include/matplot/util/concepts.h:9, from /usr/include/matplot/util/common.h:13, from /usr/include/matplot/matplot.h:9, from /home/casper/test.cpp:2: /usr/include/matplot/util/type_traits.h:78:37: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’? 78 | std::is_same_v, std::string> && | ^~~~~~~~~ | is_same /usr/include/matplot/util/type_traits.h:78:37: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’? 78 | std::is_same_v, std::string> && | ^~~~~~~~~ | is_same /usr/include/matplot/util/type_traits.h:78:75: error: wrong number of template arguments (3, should be 2) 78 | std::is_same_v, std::string> && | ^ ‘std::string_view’ has not been declared 1284 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1289:43: error: ‘std::string_view’ has not been declared 1289 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1294:43: error: ‘std::string_view’ has not been declared 1294 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1313:36: error: ‘std::string_view’ has not been declared 1313 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1317:36: error: ‘std::string_view’ has not been declared 1317 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1321:36: error: ‘std::string_view’ has not been declared 1321 | std::string_view line_spec = "*"); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1329:27: error: ‘std::string_view’ has not been declared 1329 | std::string_view line_spec = "o"); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1334:39: error: ‘std::string_view’ has not been declared 1334 | std::string_view line_spec = "o"); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1339:39: error: ‘std::string_view’ has not been declared 1339 | std::string_view line_spec); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1346:38: error: ‘std::string_view’ has not been declared 1346 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1355:38: error: ‘std::string_view’ has not been declared 1355 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1361:38: error: ‘std::string_view’ has not been declared 1361 | std::string_view line_spec); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1368:39: error: ‘std::string_view’ has not been declared 1368 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1376:39: error: ‘std::string_view’ has not been declared 1376 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1382:39: error: ‘std::string_view’ has not been declared 1382 | std::string_view line_spec); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1391:39: error: ‘std::string_view’ has not been declared 1391 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1396:39: error: ‘std::string_view’ has not been declared 1396 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1400:39: error: ‘std::string_view’ has not been declared 1400 | std::string_view line_spec); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1405:37: error: ‘std::string_view’ has not been declared 1405 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1413:36: error: ‘std::string_view’ has not been declared 1413 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1422:36: error: ‘std::string_view’ has not been declared 1422 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1430:36: error: ‘std::string_view’ has not been declared 1430 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1437:36: error: ‘std::string_view’ has not been declared 1437 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1445:22: error: ‘std::string_view’ has not been declared 1445 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1456:37: error: ‘std::string_view’ has not been declared 1456 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1466:37: error: ‘std::string_view’ has not been declared 1466 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1475:37: error: ‘std::string_view’ has not been declared 1475 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1483:37: error: ‘std::string_view’ has not been declared 1483 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1490:42: error: ‘std::string_view’ has not been declared 1490 | double scale = 1.0, std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1548:35: error: ‘std::string_view’ has not been declared 1548 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1556:20: error: ‘std::string_view’ has not been declared 1556 | std::string_view line_spec = "", double mesh_density = 40); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1562:35: error: ‘std::string_view’ has not been declared 1562 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1570:35: error: ‘std::string_view’ has not been declared 1570 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1577:35: error: ‘std::string_view’ has not been declared 1577 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1586:35: error: ‘std::string_view’ has not been declared 1586 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1593:35: error: ‘std::string_view’ has not been declared 1593 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1612:42: error: ‘std::string_view’ has not been declared 1612 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1656:34: error: ‘std::string_view’ has not been declared 1656 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1675:20: error: ‘std::string_view’ has not been declared 1675 | std::string_view line_spec = "-o"); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1679:20: error: ‘std::string_view’ has not been declared 1679 | std::string_view line_spec); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1731:53: error: ‘std::string_view’ has not been declared 1731 | labels_handle text(double x, double y, std::string_view str); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1735:63: error: ‘std::string_view’ has not been declared 1735 | const std::vector &y, std::string_view str); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1746:24: error: ‘std::string_view’ has not been declared 1746 | std::string_view str); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1754:62: error: ‘std::string_view’ has not been declared 1754 | textbox(double x, double y, double w, double h, std::string_view str); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1759:31: error: ‘std::string_view’ has not been declared 1759 | std::string_view line_spec = ""); | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1769:31: error: ‘std::string_view’ has not been declared 1769 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1775:31: error: ‘std::string_view’ has not been declared 1775 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1781:24: error: ‘std::string_view’ has not been declared 1781 | std::string_view line_spec, Args &&...args) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1794:53: error: ‘std::string_view’ has not been declared 1794 | auto plot(const IterableValues &y, std::string_view line_spec, | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1803:44: error: ‘std::string_view’ has not been declared 1803 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1809:44: error: ‘std::string_view’ has not been declared 1809 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1822:49: error: ‘std::string_view’ has not been declared 1822 | const IterableValues &z, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1830:49: error: ‘std::string_view’ has not been declared 1830 | const IterableValues &z, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1838:52: error: ‘std::string_view’ has not been declared 1838 | const IterableIterables &Z, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1845:54: error: ‘std::string_view’ has not been declared 1845 | const IterableValues &z, std::string_view line_spec, | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1860:54: error: ‘std::string_view’ has not been declared 1860 | auto plot3(const IterableValues &z, std::string_view line_spec, | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1869:34: error: ‘std::string_view’ has not been declared 1869 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1875:34: error: ‘std::string_view’ has not been declared 1875 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1882:21: error: ‘std::string_view’ has not been declared 1882 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1889:21: error: ‘std::string_view’ has not been declared 1889 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1895:47: error: ‘std::string_view’ has not been declared 1895 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1901:26: error: ‘std::string_view’ has not been declared 1901 | std::string_view line_spec, Args &&...args) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1914:55: error: ‘std::string_view’ has not been declared 1914 | auto stairs(const IterableValues &y, std::string_view line_spec, | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1925:23: error: ‘std::string_view’ has not been declared 1925 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1937:40: error: ‘std::string_view’ has not been declared 1937 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1948:40: error: ‘std::string_view’ has not been declared 1948 | std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1957:19: error: ‘std::string_view’ has not been declared 1957 | std::string_view line_spec = "k-") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1966:38: error: ‘std::string_view’ has not been declared 1966 | std::string_view line_spec = "k-") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1974:40: error: ‘std::string_view’ has not been declared 1974 | bool stacked = true, std::string_view line_spec = "k-") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1981:19: error: ‘std::string_view’ has not been declared 1981 | std::string_view line_spec = "k-") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:1988:38: error: ‘std::string_view’ has not been declared 1988 | std::string_view line_spec = "k-") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2143:49: error: ‘std::string_view’ has not been declared 2143 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2150:49: error: ‘std::string_view’ has not been declared 2150 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2190:35: error: ‘std::string_view’ has not been declared 2190 | std::string_view line_spec = "o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2199:52: error: ‘std::string_view’ has not been declared 2199 | const IterableValues &z, std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2214:24: error: ‘std::string_view’ has not been declared 2214 | wordcloud(std::string_view text, | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2216:24: error: ‘std::string_view’ has not been declared 2216 | std::string_view delimiters = " ',\n\r\t\".!?:;", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2234:31: error: ‘std::string_view’ has not been declared 2234 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2240:31: error: ‘std::string_view’ has not been declared 2240 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2247:44: error: ‘std::string_view’ has not been declared 2247 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2253:44: error: ‘std::string_view’ has not been declared 2253 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2260:49: error: ‘std::string_view’ has not been declared 2260 | const IterableValues &z, std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2268:49: error: ‘std::string_view’ has not been declared 2268 | const IterableValues &z, std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2275:32: error: ‘std::string_view’ has not been declared 2275 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2281:32: error: ‘std::string_view’ has not been declared 2281 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2306:34: error: ‘std::string_view’ has not been declared 2306 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2323:37: error: ‘std::string_view’ has not been declared 2323 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2336:36: error: ‘std::string_view’ has not been declared 2336 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2346:27: error: ‘std::string_view’ has not been declared 2346 | std::string_view line_spec = "o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2355:39: error: ‘std::string_view’ has not been declared 2355 | std::string_view line_spec = "o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2363:39: error: ‘std::string_view’ has not been declared 2363 | std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2373:22: error: ‘std::string_view’ has not been declared 2373 | std::string_view line_spec = "", size_t n_levels = 0) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2382:22: error: ‘std::string_view’ has not been declared 2382 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2390:54: error: ‘std::string_view’ has not been declared 2390 | const IterableIterables &Z, std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2400:23: error: ‘std::string_view’ has not been declared 2400 | std::string_view line_spec = "", size_t n_levels = 0) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2409:23: error: ‘std::string_view’ has not been declared 2409 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2417:55: error: ‘std::string_view’ has not been declared 2417 | const IterableIterables &Z, std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2426:39: error: ‘std::string_view’ has not been declared 2426 | std::string_view line_spec = "", | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2435:37: error: ‘std::string_view’ has not been declared 2435 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2445:41: error: ‘std::string_view’ has not been declared 2445 | double scale = 1.0, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2457:41: error: ‘std::string_view’ has not been declared 2457 | double scale = 1.0, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2471:42: error: ‘std::string_view’ has not been declared 2471 | double scale = 1.0, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2486:42: error: ‘std::string_view’ has not been declared 2486 | double scale = 1.0, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2496:42: error: ‘std::string_view’ has not been declared 2496 | double scale = 1.0, std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2551:34: error: ‘std::string_view’ has not been declared 2551 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2579:35: error: ‘std::string_view’ has not been declared 2579 | std::string_view line_spec = "-o") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2586:35: error: ‘std::string_view’ has not been declared 2586 | std::string_view line_spec) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2663:62: error: ‘std::string_view’ has not been declared 2663 | const IterableValues &y, std::string_view str) { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2670:31: error: ‘std::string_view’ has not been declared 2670 | std::string_view line_spec = "") { | ^~~~~~~~~~~ /usr/include/matplot/core/axes_type.h:2817:14: error: ‘optional’ in namespace ‘std’ does not name a template type 2817 | std::optional font_size_{10.f}; | ^~~~~~~~ /usr/include/matplot/core/axes_type.h:2817:9: note: ‘std::optional’ is only available from C++17 onwards 2817 | std::optional font_size_{10.f}; | ^~~ /usr/include/matplot/core/axes_type.h:2818:14: error: ‘optional’ in namespace ‘std’ does not name a template type 2818 | std::optional font_{"Helvetica"}; | ^~~~~~~~ /usr/include/matplot/core/axes_type.h:2818:9: note: ‘std::optional’ is only available from C++17 onwards 2818 | std::optional font_{"Helvetica"}; | ^~~ /usr/include/matplot/core/axes_type.h:649:55: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 649 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:653:55: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 653 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:735:68: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 735 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:739:68: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 739 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:749:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 749 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:755:74: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 755 | const std::vector &z, std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:762:44: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 762 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:812:58: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 812 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:816:58: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 816 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:822:45: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 822 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:828:45: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 828 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:833:45: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 833 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:905:47: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 905 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:914:64: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 914 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:927:64: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 927 | bool stacked = true, std::string_view line_spec = "k-"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:933:62: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 933 | std::string_view line_spec = "k-"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:938:64: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 938 | bool stacked = true, std::string_view line_spec = "k-"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:943:43: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 943 | std::string_view line_spec = "k-"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:948:62: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 948 | std::string_view line_spec = "k-"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:952:67: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 952 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:963:65: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 963 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:974:65: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 974 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:994:48: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 994 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1006:66: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1006 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1119:51: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1119 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1124:51: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1124 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1152:59: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1152 | std::string_view line_spec = "o"); | ^~~ | | | const char* /usr/include/matplot/core/axes_type.h:1174:49: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1174 | std::string_view delimiters = " ',\n\r\t\".!?:;", | ^~~~~~~~~~~~~~~~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1187:55: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1187 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1191:55: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1191 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1196:68: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1196 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1200:68: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1200 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1206:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1206 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1212:74: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1212 | const std::vector &z, std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1216:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1216 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1220:56: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1220 | std::string_view line_spec = "-o"); | ^~~~ | | | const char* /usr/include/matplot/core/axes_type.h:1239:58: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1239 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1265:61: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1265 | std::string_view line_spec = ""); | ^~ | | | const char* /usr/include/matplot/core/axes_type.h:1269:69: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] 1269 | std::string_view line_spec = ""); | ^~ [truncated as comment was too long] ```

Platform

Environment Details:

Additional context

cvanelteren commented 2 years ago

Clang gives a similar issue with definitions. clang++ -I /usr/include/ -L /usr/lib/ ~/test.cpp -o test

```console In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: In file included from /usr/include/matplot/util/concepts.h:9: /usr/include/matplot/util/type_traits.h:78:37: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? std::is_same_v, std::string> && ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: In file included from /usr/include/matplot/util/concepts.h:9: /usr/include/matplot/util/type_traits.h:79:41: error: no template named 'is_convertible_v' in namespace 'std'; did you mean 'is_convertible'? std::is_convertible_v>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1407:12: note: 'is_convertible' declared here struct is_convertible ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: In file included from /usr/include/matplot/util/concepts.h:9: /usr/include/matplot/util/type_traits.h:79:72: error: expected '>' std::is_convertible_v>; ^ /usr/include/matplot/util/type_traits.h:77:31: note: to match this '<' std::integral_constant>; ^ /usr/include/matplot/util/type_traits.h:81:56: error: no template named 'is_string' template constexpr bool is_string_v = is_string::value; ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:66:40: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? using String = TypeConcept, std::string>>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:66:35: error: template argument for non-type template parameter must be an expression using String = TypeConcept, std::string>>; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/matplot/util/concepts.h:18:32: note: template parameter is declared here template ^ /usr/include/matplot/util/concepts.h:71:30: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? TypeConcept, std::string>>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:71:69: error: expected '(' for function-style cast or type construction TypeConcept, std::string>>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ /usr/include/matplot/util/concepts.h:76:30: error: no template named 'is_convertible_v' in namespace 'std'; did you mean 'is_convertible'? TypeConcept, std::string>>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1407:12: note: 'is_convertible' declared here struct is_convertible ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:76:76: error: expected '(' for function-style cast or type construction TypeConcept, std::string>>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ /usr/include/matplot/util/concepts.h:82:17: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? T, std::is_same_v, std::shared_ptr>>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:82:12: error: template argument for non-type template parameter must be an expression T, std::is_same_v, std::shared_ptr>>; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/matplot/util/concepts.h:18:32: note: template parameter is declared here template ^ /usr/include/matplot/util/concepts.h:87:30: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? TypeConcept, ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:88:75: error: expected '(' for function-style cast or type construction std::shared_ptr>>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ /usr/include/matplot/util/concepts.h:110:30: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'? TypeConcept, axes_handle>>; ~~~~~^ /bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/type_traits:1354:12: note: 'is_same' declared here struct is_same ^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: In file included from /usr/include/matplot/util/common.h:13: /usr/include/matplot/util/concepts.h:110:69: error: expected '(' for function-style cast or type construction TypeConcept, axes_handle>>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ In file included from /home/casper/test.cpp:2: In file included from /usr/include/matplot/matplot.h:9: /usr/include/matplot/util/common.h:21:23: error: no type named 'string_view' in namespace 'std' bool iequals(std::string_view str1, std::string_view str2); ~~~~~^ /usr/include/matplot/util/common.h:21:46: error: no type named 'string_view' in namespace 'std' bool iequals(std::string_view str1, std::string_view str2); ~~~~~^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. ```
alandefreitas commented 2 years ago

The errors are basically saying the C++17 features, such as is_same_v and string_view, are missing. If the compiler supports C++17, you might need to turn on the C++17 flags manually or via CMAKE_CXX_STANDARD when calling CMake.

cvanelteren commented 2 years ago

I set c++ stdlib with set(CMAKE_CXX_STANDARD 17) in CMakeLists.txt. After that I am getting missing symbols. Not sure how to debug the linkage error.

` g++ -std=c++17 -I/usr/local/include/ test.cpp -I/usr/include -o test ` ``` /bin/ld: /tmp/ccdsu2Ex.o: in function `matplot::show()': test.cpp:(.text._ZN7matplot4showEv[_ZN7matplot4showEv]+0x20): undefined reference to `matplot::gcf()' /bin/ld: test.cpp:(.text._ZN7matplot4showEv[_ZN7matplot4showEv]+0x34): undefined reference to `matplot::figure_type::show()' collect2: error: ld returned 1 exit status ```
alandefreitas commented 2 years ago
g++ -std=c++17 -I/usr/local/include/ test.cpp -I/usr/include -o test

You're not linking the library. Thus, the symbols are missing. See -L compiler option or use CMake for integration. Also make sure you are using the same compiler you used to build matplot++.

cvanelteren commented 2 years ago

I got it to compile and run g++ -o test test.cpp /usr/lib/libmatplot.a /usr/lib/Matplot++/libnodesoup.a /usr/lib/libtiff.so /usr/lib/libjpeg.so /usr/lib/libz.a /usr/lib/libpng.so

I am not entirely sure why linking with -L didn't work. I take it that the preferred method is to use cmake for generating plots and not one-off scripts using method above?

alandefreitas commented 2 years ago

Yes. Having a build system is almost always the preferred method.

cvanelteren commented 2 years ago

Thanks for the help, will take this package for a spin.