I'm working on a image processing proyect where I need to locate and label some face attributes (ie.: mouth, nose, eyes, etc.). I'm trying to use the STASM-ASM algorithm (http://www.milbo.users.sonic.net/stasm/), I already used this technique in a previous proyect done in Windows where I obtained very good results.
The problem arrives when trying to use this utility in Linux, I builded the object .o files following the instructions provided from the author. Then, I created a static library following the instructions in How to create a static library with g++?. Then, I linked this static library to my proyect and included the following header file:
// stasm.h
#ifndef STASM_H_
#define STASM_H_
void AsmSearchDll(int *pnlandmarks, int landmarks[], const char image_name[], const char image_data[], const int width, const int height, const int is_color, const char con f_file0[], const char conf_file1[]);
#endif
When trying to build this proyect I get te following error:
undefined reference to `AsmSearchDll(int*, int*, char const*, char const*, int, int, int, char const*, char const*)'
This seems very strange to me as I'm sure the header file is correctly included. I also tried with the .hpp file included by the author on the package and obtained the same exact results. This problem is similar to the one treated in Trying to get stasm to work on Ubuntu . But, that post remains without a final solution. I hope someone could help me to work this out, the STASM-ASM utility is really great and it is pity it can't be used in linux as it is provided.
I think the problem is not of types mismatch, I concluded this after analyzing the call to the ASMSearchDll function and its declaration. The function is called as follows:
AsmSearchDll(&nlandmarks, landmarks, image_name, img->imageData, img->width, img->height,1 /* is_color */, NULL /* conf_file0 */, NULL /* conf_file1 */);
And the function definition is the following:
// stasm_dll.hpp
#ifndef stasm_dll_hpp
#define stasm_dll_hpp
extern "C"
void AsmSearchDll(
int *pnlandmarks, // out: number of landmarks, 0 if can't get landmarks
int landmarks[], // out: the landmarks, caller must allocate
const char image_name[], // in: used in internal error messages, if necessary
const char image_data[], // in: image data, 3 bytes per pixel if is_color
const int width, // in: the width of the image
const int height, // in: the height of the image
const int is_color, // in: 1 if RGB image, 0 for grayscale
const char conf_file0[], // in: 1st config filename, NULL for default
const char conf_file1[]); // in: 2nd config filename, NULL for default, "" if none
#endif // stasm_dll_hpp
Additionally, if I change the format of one of the parameters passed to the function I get errors like the following:
../src/PruebaStasm.cpp:44:155: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive]
../src/stasm_dll.hpp:6:6: error: initializing argument 1 of ‘void AsmSearchDll(int*, int*, const char*, const char*, int, int, int, const char*, const char*)’ [-fpermissive]
I compiled again the .o files using the provided makefile, with these .o files I created shared and dynamic libraries following this tutorial: http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
I don't understand where the problem is.
Best Regards,
Luis