A few days ago I was working on an embedded system based on a Raspberry Pi and a case with a built-in display. The manufacturer of the display - emsystech - was delivering C libraries, but I used a Qt C++ project to create our software.

After setting up the development environment - described in the Qt Project - I ran into compiler problems. The includes of the C libraries generated ‘undefined references’ error.

It looks like the problem was the C++ compiler which was trying to interpret the C includes. To circumvent it we have to use an ‘external’ include. Maybe there are some other solution to this problem, but this one worked for us.

For example in my main.cpp file after the includes:

extern "C" {
	#include "std_c.h"
	#include "display.h"
	#include "example.h"
	#include "example2.h"

After that the compilation process was running without errors and created a functional program.