Hi community!
I'm a beginner in FreeBSD and C/C++ world and my English is bad Sorry.
I have a problem with libsysinfo 0.0.3_2
My Project: I install FreeBSD 13 + prosody on RPi3 this sends reports to my client on a daily basis (cron). It works fine with Python + xmpp + psutil libs for Python.
I was thinking why I should use Python when I can use C/C ++. Because C/C ++ is at home with FreeBSD. In principle everything is ready there without a third-party library.
In future I also want to address GPIO with c / c ++
My code:
My error:
I wanted to reproduce the error in other OS.
OS 1: Arch Linux AMD64, HW Acer NITRO 5 = No error
OS 2: RaspianOS , HW Raspberry Pi 4 = No error
I know Linux is not FreeBSD !
I thought it was because of the Rpi3, so I installed VM with FreeBSD and got the same error.
Any idea ?
Best regards!
I'm a beginner in FreeBSD and C/C++ world and my English is bad Sorry.
I have a problem with libsysinfo 0.0.3_2
My Project: I install FreeBSD 13 + prosody on RPi3 this sends reports to my client on a daily basis (cron). It works fine with Python + xmpp + psutil libs for Python.
I was thinking why I should use Python when I can use C/C ++. Because C/C ++ is at home with FreeBSD. In principle everything is ready there without a third-party library.
In future I also want to address GPIO with c / c ++
My OS | uname -a | FreeBSD 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 |
My HW | Raspberry Pi3 Model B+ | |
C/C++ Compiler | g++11 -v | COLLECT_GCC=g++11 Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.2.0 (FreeBSD Ports Collection) |
My code:
C:
#include <stdio.h>
#include <sys/sysinfo.h>
int main ()
{
const long minute = 60;
const long hour = minute * 60;
const long day = hour * 24;
const double megabyte = 1024 * 1024;
struct sysinfo (si);
sysinfo(&si);
printf ("system uptime : %ld days, %ld:%02ld:%02ld\n",
si.uptime / day, (si.uptime % day) / hour,
(si.uptime % hour) / minute, si.uptime % minute);
printf ("total RAM : %5.1f MB\n", si.totalram / megabyte);
printf ("free RAM : %5.1f MB\n", si.freeram / megabyte);
printf ("process count : %d\n", si.procs);
return 0;
}
My error:
Code:
/usr/local/bin/ld: /tmp//cc6mu3AE.o: in function `main':
datetime.cpp:(.text+0x4c): undefined reference to `sysinfo'
collect2: error: ld returned 1 exit status
OS 1: Arch Linux AMD64, HW Acer NITRO 5 = No error
OS 2: RaspianOS , HW Raspberry Pi 4 = No error
I know Linux is not FreeBSD !
I thought it was because of the Rpi3, so I installed VM with FreeBSD and got the same error.
Any idea ?
Best regards!