fcorbelli / zpaqfranz

Deduplicating archiver with encryption and paranoid-level tests. Swiss army knife for the serious backup and disaster recovery manager. Ransomware neutralizer. Win/Linux/Unix
MIT License
275 stars 25 forks source link

Use a C++ compiler to build on non-Windows platforms #51

Closed ZhongRuoyu closed 1 year ago

ZhongRuoyu commented 1 year ago

zpaqfranz.cpp is a C++ program, so it should be built with a C++ compiler.

Also, -lstdc++ is removed from LDADD because this should already be added by the C++ compiler.

Fixes #50.

ZhongRuoyu commented 1 year ago

Sorry for the noise above! I didn't add -std=c++11 initially because I thought this should be the default for recent C++ compilers. But it turned out that the flag is still needed. At least clang++ still didn't like the double right brackets (our build logs can be found here).

ZhongRuoyu commented 1 year ago

As an unintended side effect, another issue was observed: this time, Linux complained about this (build logs):

  g++-11  -O3 -std=c++11 -Dunix zpaqfranz.cpp -o zpaqfranz -pthread -lm
  zpaqfranz.cpp: In function ‘int64_t getramdisksize()’:
  zpaqfranz.cpp:52412:16: error: ‘internal_getramdisksize’ was not declared in this scope
  52412 |         return internal_getramdisksize(); /// if you get an error HERE substitute with return 0;
        |                ^~~~~~~~~~~~~~~~~~~~~~~
  make: *** [NONWINDOWS/Makefile:18: zpaqfranz] Error 1

This was due to usage of a non-standard macro linux. In 4cc32b6ffa599e3b9528c4c97d52b6ebcc697efa, I replaced linux and __linux with the standard-comforming __linux__, and the error was fixed. See: https://stackoverflow.com/questions/142508/how-do-i-check-os-with-a-preprocessor-directive.