0

I have installed the mathgl library using

sudo apt-get install mathgl

Then from their sourceforge page I copied the following example program.

#include <mgl2/qt.h>
int sample(mglGraph *gr)
{
  gr->Rotate(60,40);
  gr->Box();
  return 0;
}

int main(int argc,char **argv)
{
  mglQT gr(sample,"MathGL examples");
  return gr.Run();
}

And the

gcc test.cpp -lmgl-qt -lmgl -lm

I get the following error message

test.cpp:1:21: fatal error: mgl2/qt.h: No such file or directory
 #include <mgl2/qt.h>
                     ^
compilation terminated.

Now I looked for this header file using locate and I couldn't find it. I get this problem so often that I install a library and then spend ages trying to get the compiler to know where to find the linker and header files (I am a bit of a beginner) and I think to myself there must be a better way or something that I am missing. So how can I locate the files I need and let the compiler know where to search?

m.s.
  • 16,063
  • 7
  • 53
  • 88
Slugger
  • 665
  • 1
  • 5
  • 17
  • I have to use C/C++ for my study so I often default to using this language. However, which language would you suggest? I am particularly interested in visualization of fluid flow problems. – Slugger Oct 19 '15 at 10:56
  • I don't want to suggest any because a) it's not related to the question; b) it would immediately attract people who disagree with my suggestion that'd want to lynch me as a fanboy or something. Point being, having reasonable package system is something that helps in development and C++ doesn't have that; if you have an option to use another language, in a long term it might be a solution. It won't help you to fix that particular problem though. – Bartek Banachewicz Oct 19 '15 at 10:58
  • If you want to write programs that use a package, you normally need to install a development version of said package. Such versions have suffix `-dev` or `-devel` in various Linux distros. – n. m. could be an AI Oct 19 '15 at 11:00

1 Answers1

3

You need to install the developer package:

sudo apt-get install libmgl-dev

This package contains both the headers and the libraries, see the file list.

m.s.
  • 16,063
  • 7
  • 53
  • 88