Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:44:45+00:00 2026-06-14T13:44:45+00:00

I’m working on my undergraduate thesis in mechanical engineering and I’m having trouble plotting

  • 0

I’m working on my undergraduate thesis in mechanical engineering and I’m having trouble plotting data. The project is to use computer vision to automatically generate a high-quality CAD model of a real-world object.

I want to pass processed data to GNUPLOT in order to quickly generate a graph. I’m using temporary files to pass the data back and forth. (Note: if you know of a cleaner way to do this then by all means point it out.)

Every time I attempt to compile the program, though, I get the following error:

/home/ryan/Code/FullyReversed/fullyreversed.cpp:-1: error: undefined reference 
to `QImage fr::Plotter::plot<double>(std::vector<double, std::allocator<double> >,
unsigned int, unsigned int)'

I don’t understand where this error is coming from. It seems that the compiler is replacing my vector<double> with another, more complex structure

So, in short, what is the matter with the way I’m passing the data to Plotter::plot?

In my program’s main class:

void MainWindow::plotData()
{
    double i;
    vector<double> intensity;
    static QImage plot;

    for(i=-10;i<10;i+=.1){
        intensity.push_back(1/(i*i+1));
    }

    plot = Plotter::plot(intensity,800,600);
    showQ(plot);
}

In the auxiliary Plotter class:

template <typename T>
QImage Plotter::plot(vector<T, allocator<T> > data, unsigned int width, unsigned int height){

    // for creating the filename
    char buffer[256];

    // the file we'll be writing to
    ofstream file;

    // loop counter
    unsigned int i;

    // time file generated
    time_t ftime = time(NULL);

    // generate the filename
    sprintf(buffer,"%d.dat",ftime);

    // open the file
    file.open(buffer);

    // write the data to the file
    for(i=0;i<data.size();i++){
        file << i << " " << data.at(i) << endl;
    }

    //generate the command
    sprintf(buffer,"gnuplot -e \"set terminal png size %d, %d;set output '%d.png';plot sin(x);\"",width,height,ftime);

    // call GNUPLOT
    system(buffer);

    // load the image
    sprintf(buffer,"%d.png",ftime);
    QImage out = QImage(buffer);

    return out;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:44:46+00:00Added an answer on June 14, 2026 at 1:44 pm

    This is a symptom of defining a template function in a source file instead of a header file.

    A template isn’t an actual function, it’s just the instructions for building a function. The whole code needs to be available at the point where you call it so that the compiler can generate the proper function for you. If it doesn’t have it, it assumes one is defined somewhere else and leaves the linker to figure it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.