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
259 stars 22 forks source link

signal was not declared in this scope #78

Closed tansy closed 11 months ago

tansy commented 12 months ago

Trying to compile it in Linux got this error:

error: ‘signal’ was not declared in this scope Added signal header include in the unix section.

Error in full:

g++ -std=c++11 -Wall -O2 -c -o zpaqfranz.o zpaqfranz.cpp
zpaqfranz.cpp: In function ‘int main(int, const char**)’:
zpaqfranz.cpp:54352:10: error: ‘SIGINT’ was not declared in this scope
  signal (SIGINT,my_handler); // the control-C handler
          ^~~~~~
zpaqfranz.cpp:54352:27: error: ‘signal’ was not declared in this scope
  signal (SIGINT,my_handler); // the control-C handler
                           ^
make: *** [zpaqfranz.o] Error 1

When looked for error I got this this answer: You haven't included signal.h. . Therefore added #include <signal.h>.

fcorbelli commented 12 months ago

error: ‘signal’ was not declared in this scope Added signal header include in the unix section.

include

Compiling... where?

tansy commented 12 months ago

In Linux. Updated first post with explanation.

fcorbelli commented 12 months ago

In Linux.

Can you please write the exact distro and version? I'll check and fix tomorrow (only Windows now) Thank you

tansy commented 12 months ago

Slackware 14.x, heavily updated. GCC 4.9, 6.5, Clang 3.8, same result.

fcorbelli commented 12 months ago

Slackware 14.x, heavily updated. GCC 4.9, 6.5, Clang 3.8, same result.

Cannot reproduce on Slackware 15, gcc 11.2.0, clang 13.0.0 I'll try with version 14

tansy commented 12 months ago

only Windows now

https://www.virtualbox.org/ http://www.slackware.com/getslack/

fcorbelli commented 12 months ago

only Windows now

https://www.virtualbox.org/ http://www.slackware.com/getslack/ Slackware64 14.0 VM gcc 5.3.0 clang 3.8.0 g++ -O3 -Dunix zpaqfranz.cpp -o zpaqfranz -pthread -std=c++11 clang++ -O3 -Dunix zpaqfranz.cpp -o zpaqfranz -pthread -std=c++11

Slackware64 15.0 VM gcc 11.2.0 g++ -O3 -Dunix zpaqfranz.cpp -o zpaqfranz -pthread -lstdc++ -lm clang 13.0.0 clang++ -O3 -Dunix zpaqfranz.cpp -o zpaqfranz -pthread

Now on Slackware 12 32 bit , work in progress...

fcorbelli commented 12 months ago

On old compilers the -DANCIENT is mandatory, for example

Slackware 12.0 (32 bit)
gcc 4.1.2
g++ -O3 -DANCIENT -Dunix zpaqfranz.cpp -o zpaqfranz -pthread

This will disable the Control-C handler

tansy commented 12 months ago

What you call ancient? Your Linux esxi (whatever that means) executable is compiled with gcc-3.4.6.

fcorbelli commented 12 months ago

What you call ancient? Your Linux esxi (whatever that means) executable is compiled with gcc-3.4.6.

ESXi is the VMware hypervisor
Ancient is, for example, Power PC-powered Macs, some very old Solaris machines etc For Linux just about anything earlier of gcc 7.3 (of 2018) is ancient, for me at least. If zpaqfranz does not compile, try -DANCIENT
Cannot "guess" what your compiler do/don't support gcc 5.3 is 8 years old, about 40 releases older then the current one clang 3.8 about 50 releases

fcorbelli commented 11 months ago

To facilitate cross-platform portability, I will not include signal.h