ReneNyffenegger / cpp-base64

base64 encoding and decoding with c++
Other
891 stars 311 forks source link

How to build and install the base64 libraries ? #26

Closed sandeshk1 closed 3 years ago

sandeshk1 commented 3 years ago

make throws the below error

$ make g++ -std=c++11 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-declarations -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option -c base64.cpp -o base64-11.o g++ -std=c++11 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-declarations -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option -c test.cpp -o test-11.o g++ base64-11.o test-11.o -o base64-test-11 g++ -std=c++17 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-declarations -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option -c base64.cpp -o base64-17.o g++ -std=c++17 -Werror -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-declarations -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option -c test.cpp -o test-17.o g++ base64-17.o test-17.o -o base64-test-17 base64-test-11 make: base64-test-11: Command not found Makefile:30: recipe for target 'test' failed make: *** [test] Error 127

Bouska commented 3 years ago

The issue here is that the Makefile was made for a system where the current directory is part of the PATH. Anyway, the Makefile is only here to build and run the tests, not to build a library. Just copy and add base64.cpp/.h in you project/build system.

sandeshk1 commented 3 years ago

Noticing the below error while trying to include base64.cpp and calling the base64_encode()

**undefined reference to `base64_encode[abi:cxx11](unsigned char const*, unsigned long, bool)'**

Looks like this is a linking error caused due to library being compiled with older GCC version. Can it be re-built with the new ABI ?