Question

I started experimenting with C/C++ the other day because I needed it for reading level-4 MAT-files without needing to purchase the Matlab editor or compiler. So I found just the library that I needed but I'm not familiar with C or C++ at all so I'm a beginner with those two languages. Anyhow I need to include the 'matio' library. I've tried many things but I've had no luck.

I right clicked on the C/C++ project > properties > C/C++ General > Paths & Symbols > GNU C and added the path to the matio library.

I also went to C/C++ Build > Settings > Tool settings > GCC C Compiler > Includes and added the path there aswell.

Since I'm not any good with makefiles yet I did not specify my own makefile, instead I chose a executable project.

When I try to build my project it complains about a function called 'Mat_Open' in the matio library. When I hover over it, it says "undefined reference to 'Mat_Open'" the header 'matio.h' seems to work fine but it can't refer to 'Mat_Open' for some reason.

How do I solve this?

EDIT:

Here is the whole build console output.

10:42:52 **** Incremental Build of configuration Debug for project Project ****
Info: Internal Builder is used for build
gcc -IC:/matio-1.5.2/src -O0 -g3 -Wall -c -fmessage-length=0 -o CComponent.o "..\\CComponent.c" 
gcc -Xlinker -lm -o Project.exe CComponent.o -lC:/matio-1.5.2/src 
c:/mingw(x64)/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lC:/matio-1.5.2/src
collect2.exe: error: ld returned 1 exit status

10:42:53 Build Finished (took 330ms)
Was it helpful?

Solution

This is not necessarily an answer but may be useful for a comparison.

First of all, where did you install it? If your using Linux or Mac OSX you will want to install in the system directories (not sure about Windows). I use OSX so in my makefile (by the way I use Qt):

LIBS += -L/usr/local/lib/ -lmatio
INCLUDEPATH += /usr/local/include

Then of course, in the *.h files of my source I use:

#include "matio.h"

But I assume you have already tried that?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top