Wednesday, December 15, 2021

Share folder from macOS to VirtualBox

Follow these steps to share a folder from your host macOS to guest Kali Linux running inside VirtualBox.

Step 1: From your macOS, Go to "System Preferences... >> Sharing"

Step 2: Enable the File Sharing option and add a folder to share

Step 3: Open VirtualBox >> Select Kali Linux (or any other image)

Step 4: Click on "Settings >> Share Folder"

Step 5: Click on Add new shared folder button and add the same folder you previously added in macOS from Step 2
Step 6: Log in to your Kali Linux image

Step 7: Open Terminal and type the command "sudo adduser $USER vboxsf"

Step 8: Reboot Kali Linux

Thursday, December 09, 2021

[Solved] error: ‘getrusage’ was not declared in this scope


Error:

vb_perf.cpp: In function ‘int main(int, const char**)’:
vb_perf.cpp:63:23: error: variable ‘main(int, const char**)::rusage rusage’ has initializer but incomplete type
   63 |         struct rusage rusage = { };
      |                       ^~~~~~
vb_perf.cpp:64:19: error: ‘RUSAGE_SELF’ was not declared in this scope
   64 |         getrusage(RUSAGE_SELF, &rusage);
      |                   ^~~~~~~~~~~
vb_perf.cpp:64:9: error: ‘getrusage’ was not declared in this scope; did you mean ‘rusage’?
   64 |         getrusage(RUSAGE_SELF, &rusage);
      |         ^~~~~~~~~
      |         rusage


Solution:

Include this header to your source code:

#include <sys/resource.h>