Good morning everyone.
I have a main program in C, and I just want to call a function that is in another C ++ file and get the return of this function.
How do I do this? I researched and saw that "extern" can help but I am not succeeding.
Here's what I want to do: In the program.c:
#include <stdio.h>
#include <stdlib.h>
#include "chain_code.cpp" // Arquivo C++
extern int chains(char*);
int main (int argc, char* argv[]){
// Faz alguma coisa
printf("%d ", chains(argv[1])); // Chama a função que está programada em C++
}
In the file "chaincode.cpp":
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
// Outros includes
int chains(char* path){
// Gera histograma da imagem Path
// devolve a media do histograma
I'm new here so I'm sorry I made it hard to read.