Aufrufen von C ++ - Funktionen aus einer C-Datei

Ich bin ziemlich neu in C und C ++. Aber ich habe einige C ++ - Funktionen, die ich von C aus aufrufen muss. Ich habe ein Beispiel für das gemacht, was ich tun muss

Haupt c:

#include "example.h"      
#include <stdio.h>

int main(){   
    helloWorld();
    return 0;
}

example.h:

 #ifndef HEADER_FILE
 #define HEADER_FILE

 #ifdef __cplusplus
     extern "C" {
 #endif
         void helloWorld();
 #ifdef __cplusplus
     }
 #endif

 #endif

example.cpp:

#include <iostream.h>

void helloWorld(){
    printf("hello from CPP");
} 

Es funktioniert einfach nicht. Ich erhalte immer noch den Fehler undefinierten Verweises auf_helloWorld in meinemmain.c. Wo ist das Problem?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage