Thread: Datatype errors while threading using templates

  1. #1
    Registered User
    Join Date
    Apr 2016
    Posts
    17

    Datatype errors while threading using templates

    Hi everyone,

    I'm struggling with a particular c++ assignment. We're asked to parallelize a sequential task that uses the boost library to detect edges in a given image, but I just can't seem to get the datatypes to work properly. I am using c++ threads to paralleize.

    In the x_gradient_par.h file, a function x_gradient() is declared. x_gradient() creates a variable number of threads which then perform edge detection on the different segments of the source image. The assignment uses templates heavily and I'm having a hard time passing parameters and using them in the thread function x_gradient_par.
    The main error I'm getting is 'invalid use of incomplete type..'
    I've attached all relevant files.

    x_gradient_par.h: Parallel version of x_gradient() to be implemented.
    x_gradient_seq.h: Sequential version of x_gradient() (Provided with assignment to serve as reference)
    main.cpp
    x_gradient.h: Header file for x_luminosity_gradient(). The function which calls x_gradient()
    errors.txt: log of compilation errors.

    I realize this is a lot of files. However, the core of the problem lies in x_gradient_par.h
    I just want to be as thorough with my description of the problem as possible to make it clearer for you guys.

    Appreciate any tips you can give me!

    x_gradient.h
    main.cpp
    errors.txt
    x_gradient_seq.h
    x_gradient_par.h

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    'invalid use of incomplete type..'

    From experience you normally get this error when you have failed to include the correct header.

    Figure out which header defines the type it is complaining about; then, include it.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 09-23-2012, 03:06 PM
  2. Linker errors with Templates...
    By Petike in forum C++ Programming
    Replies: 2
    Last Post: 09-03-2008, 09:52 AM
  3. templates and linker errors
    By Warlax in forum C++ Programming
    Replies: 11
    Last Post: 11-15-2006, 01:37 AM
  4. Linker Errors with Templates
    By LPP in forum C++ Programming
    Replies: 16
    Last Post: 10-20-2006, 08:45 PM
  5. Stack errors using templates
    By Nakeerb in forum C++ Programming
    Replies: 6
    Last Post: 11-29-2002, 03:16 PM

Tags for this Thread