I am compiling my C++ application and want to link it to mono. I am using OpenSusE. I have install mono-complete and glibc-devel-static packages. I am compiling as below -
$>g++ --static monoapp.cpp `pkg-config --cflags --libs mono` -I /usr/include/mono-2.0
/tmp/ccGfpBjX.o: In function `Launch(char const*, char const*, int, char const* const*, char const*)':
monoapp.cpp:(.text+0x23e): undefined reference to `mono_set_dirs'
monoapp.cpp:(.text+0x24f): undefined reference to `mono_jit_init_version'
monoapp.cpp:(.text+0x28b): undefined reference to `mono_domain_assembly_open'
monoapp.cpp:(.text+0x2c2): undefined reference to `mono_jit_exec'
collect2: error: ld returned 1 exit status
UPDATE 1 - I tried giving -lmono to linker but it complains about -lmono not found. Below is output of locate command.
$>locate libmono
/usr/lib64/libmono-2.0.a
/usr/lib64/libmono-2.0.so
/usr/lib64/libmono-2.0.so.1
/usr/lib64/libmono-2.0.so.1.0.0
Above output clearly shows that libmono is present.
UPDATE -2 Output of pkg-config is empty
$>pkg-config --cflags --libs mono
$>
UPDATE -3- I tried setting up PKG_CONFIG_PATH so that it can find mono.pc file but still it did not work
Please help.
Thanks, Omky
I solved this by providing full path to static lib as -
g++ --static monoapp.cpp pkg-config --cflags --libs mono
-I /usr/include/mono-2.0 -L /usr/lib64/ -lmono