Results 1 to 3 of 3

Thread: how to use boost multi_array in QtCreator

  1. #1
    Join Date
    Feb 2009
    Location
    Clermont-Ferrand, France
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to use boost multi_array in QtCreator

    Hi all

    Im trying to use multi_array from the boost library in QtCreator
    but i always get lots of compile error

    the code is the simple example from boost webpage
    it seems that the problem comes from boost::extents
    do i need to add some special options in my .pro file ?
    thanks


    #include "boost/multi_array.hpp"
    #include <cassert>


    // Create a 3D array that is 3 x 4 x 2
    typedef boost::multi_array<double, 3> array_type;
    typedef array_type::index index;
    array_type A(boost::extents[3][4][2]);

    // Assign values to the elements
    int values = 0;
    for(index i = 0; i != 3; ++i)
    for(index j = 0; j != 4; ++j)
    for(index k = 0; k != 2; ++k)
    A[i][j][k] = values++;

    // Verify values
    int verify = 0;
    for(index i = 0; i != 3; ++i)
    for(index j = 0; j != 4; ++j)
    for(index k = 0; k != 2; ++k)
    assert(A[i][j][k] == verify++);

    return 0;
    }

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to use boost multi_array in QtCreator

    could you please post the errors you are getting..also whenever u post a code, select all of the code and click on "#" on the toolbar above the textbox..no need to tell you that it increases readablity and is kinda a necessity when u use a forum..i believe u'll get a warning from the administrator anyway

  3. #3
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to use boost multi_array in QtCreator

    Well, you need to tell your project where to look for Boost's includes and libs.

    If you're editing a .pro file, these things go into
    INCLUDEPATH += <path to boost includes>
    # if you're using a boost lib that is not header only (like regex)
    LIBPATH += <path to boost libs>
    LIBS += <any boost libs you need to link against>

    Maybe with QtCreator there is a nice dialog to enter these things.

    HTH

Similar Threads

  1. [Solved] Using a Subversion Client with QtCreator
    By philwinder in forum Qt Tools
    Replies: 1
    Last Post: 30th November 2010, 22:16
  2. Qt + boost + MinGW on Windows
    By akos.maroy in forum Newbie
    Replies: 3
    Last Post: 12th June 2008, 14:53

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.