TBC
Heisenberg - Digital Alchemist, Software Architect, Automation Specialist and Mechanical Engineer.
Labels
Sunday, 30 August 2026
Friday, 24 April 2026
Target windows XP from Mac using Netbeans and Docker
I had tried building C/C++ applications for Windows XP using my Mac and mingw-w64 installed using Home-brew but it just didnt work out. This mostly resulted in the following when trying to run the executable on Windows XP;
What I finally discovered and use is, setting up a Docker image with the appropriate XP-compatible toolchain, ie. a MinGW that targets MSVCRT, not UCRT.
Sunday, 19 April 2026
Wednesday, 25 October 2023
Monday, 4 September 2023
Friday, 9 December 2022
How to remove a char from a C char array by index.
I use the following to remove a char from a C char array by index.
In this instance, I search for the first char and if it's a 0 then remove it.
Friday, 22 July 2022
Tuesday, 12 July 2022
Thursday, 23 June 2022
Wednesday, 6 April 2022
Functions and String in C
Functions and String in C
See also here
Wednesday, 6 January 2021
Problem building meslink
I had trouble building mesllink using Netbeans but note that it did build correctly from the original source on the box, from the command line by running make.
This is similar to a problem I had with mesdb detailed here. (worth reading first).
Sunday, 20 December 2020
Problem building mesdb
I had trouble building mesdb using Netbeans but note that it did build correctly from the original source on the box, from the command line by running make.
Sunday, 1 November 2020
mysql++.h and libmysql++-dev missing in Debain 10
mysql++
is missing in Debian 10 and despite several attempts to install it, I haven't yet been able to, so...
to install it under Debian Bullseye, do;
apt install libmysql++-dev
Bullseye can be found here: https://www.debian.org/devel/debian-installer/
See also here: https://packages.debian.org/search?keywords=libmysql%2B%2B-dev&searchon=names&suite=all§ion=all
Thursday, 22 October 2020
To change Netbeans C++ binary output location
RIGHT-CLICK PROJECT
PROJECT PROPERTIES > LINKER > GENERAL > OUTPUT
Sunday, 20 September 2020
C, C++ Structure - The . and the -> notation
A brief reminder about dot and arrow operators.
Saturday, 5 September 2020
Run a C program as a daemon in Linux
Mostly from here
The complete working skeleton code can be found here
When launched, this will live for 20 seconds and then terminate, logging startup and exit messages to /var/log/messages not syslog as expected on Slackware 14.2 but verified to write to /var/log/syslog on Debian 10.5
This can be pulled from: https://github.com/plisken1/daemon_template.git
Writing to the message log in Linux with C
The following is an example of writing to the message log in Linux with C
from here, maybe here and also here if you are feeling brave.
#include <syslog.h>
#include <stdio.h>
int main()
{
setlogmask (LOG_UPTO (LOG_NOTICE));
openlog ("myprogramlog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
for (int x=0;x<10;x++)
{
syslog (LOG_NOTICE, "Program started, count = %d",x);
syslog (LOG_INFO, "A tree falls in a forest");
}
closelog ();
return 0;
}
Linux Daemon Writing HOWTO
The following is a copy of the document from here
Linux Daemon Writing HOWTO
Devin Watson
v1.0, May 2004This document shows how to write a daemon in Linux using GCC. Knowledge of Linux and a familiarity with C are necessary to use this document. This HOWTO is Copyright by Devin Watson, under the terms of the BSD License.
Friday, 4 September 2020
Build C++ app in CLion for Linux (including a MySQL application)
How to build a C++ application, using MySQL and deploy on Linux.
In this case, we are using Debian 10 (also works on Slackware 14.2)
We are building an application (example can be found here, albeit slightly modified but importantly includes mysql.h). Also on GitHub here
MySQL install on Debian & solution to mysql-config not found.
To install mysql server on Debian
apt-get install mariadb-server
To start, run;
service mysql start
I also found mysql_config not to be found on Debian 10
likely due to the development stuff not being installed as I could also not find /usr/include/mysql
so, installing and resolving is as follows;
sudo apt-get install libmariadb-dev-compat
also worthwhile maybe;
alp-get install libmysqlcppconn-dev
apt-get install libmysql++
