Results 1 to 5 of 5

Thread: Problem #include <meschach/matrix.h> in Qt4/C++

  1. #1
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem #include <meschach/matrix.h> in Qt4/C++

    I want to use the Meschach library of matrix functions in my C++ code and in particular my Qt4 project but I'm getting a lot of errors if I #include it.

    I've tried extern:

    Qt Code:
    1. extern "C" {
    2. #include <meschach/matrix.h>
    3. }
    To copy to clipboard, switch view to plain text mode 

    name spaces

    Qt Code:
    1. namespace Meschach {
    2. #include <meschach/matrix.h>
    3. }
    To copy to clipboard, switch view to plain text mode 

    But I just get a lot of compile errors, such as :

    /usr/include/qt4/QtCore/qmap.h:434: error: expected ‘(’ before ‘{’ token
    The errors mostly occur with Qt core files.

    As soon as I comment out the #include <meschach/matrix.h> the problems go away !

    Note, that I am using the Mechsach dynamic library so I'm not compiling any of it's code.

    Could anyone give me some advice ? I must be able to call these C-library functions somehow.

  2. #2
    Join Date
    May 2010
    Posts
    24
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem #include <meschach/matrix.h> in Qt4/C++

    The original library defines some macros that are incompatible with C++ syntax and Qt (i.e "catch" which is a reserved keyword, "error"/"warning" which are member functions in a lot of Qt classes).

    These problems should be fixed in Meschach++: http://wwwmaths.anu.edu.au/~steve/research

  3. #3
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem #include <meschach/matrix.h> in Qt4/C++

    Quote Originally Posted by alexisdm View Post
    The original library defines some macros that are incompatible with C++ syntax and Qt (i.e "catch" which is a reserved keyword, "error"/"warning" which are member functions in a lot of Qt classes).

    These problems should be fixed in Meschach++: http://wwwmaths.anu.edu.au/~steve/research
    Thanks Alexisdm.

    I have decided to go with the blitz++ library though I did download the source files from your link. Unfortunately I had a lot of warnings about deprecated functions and finally an error in the build and I don't want to spend my time trying to resolve the build problems.

    But thanks for your link. I might return to it when time allows. Meschach is apparently quite fast in C so would be interested in seeing what the C++ equivilant can do.

  4. #4
    Join Date
    Aug 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem #include <meschach/matrix.h> in Qt4/C++

    Quote Originally Posted by alexisdm View Post
    The original library defines some macros that are incompatible with C++ syntax and Qt (i.e "catch" which is a reserved keyword, "error"/"warning" which are member functions in a lot of Qt classes).

    These problems should be fixed in Meschach++: http://wwwmaths.anu.edu.au/~steve/research
    Actually alexisdm I've hit a problem with blitz... it doesn't do correct matrix multiplication ! However as I mentioned above, Meschach++ doesn't build on my machine (Linux). Have you built it and had any problems?

  5. #5
    Join Date
    May 2010
    Posts
    24
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem #include <meschach/matrix.h> in Qt4/C++

    I tried compiling it on Linux, and it seems to work.
    You have to create a "lib" directory and run make from the src directory.
    Qt Code:
    1. tar xvf MeschPP.tgz
    2. cd MeschPP
    3. mkdir lib
    4. cd src
    5. make
    To copy to clipboard, switch view to plain text mode 
    The tests compile fine too, except one.

    There are still some macros (error and warning) that could conflict with Qt, so you'll probably need to include the header "meschpp.h" after Qt headers.

Similar Threads

  1. Replies: 6
    Last Post: 22nd November 2016, 13:57
  2. Include problem after rebuild. Mac OSX 10.6
    By Manjak in forum Qt Programming
    Replies: 1
    Last Post: 5th March 2010, 13:07
  3. Opencv include problem
    By cae in forum Newbie
    Replies: 2
    Last Post: 12th February 2010, 09:25
  4. #include problem in eclipse with qt4.4.0
    By snatcher in forum Newbie
    Replies: 3
    Last Post: 5th August 2009, 04:04
  5. problem with an include
    By mickey in forum General Programming
    Replies: 1
    Last Post: 20th July 2006, 13:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.