Solved

Can't solve a linking error

Posted on 1997-02-26
1
205 Views
Last Modified: 2010-04-10
I am trying to link a whole series of files each with its own node (in Borland C++4.5).  There do not appear to be any errors in the code itself only in the linking.  The message I get is

   Undefined symbol arrayread(char far*, int) in module easywav2.cpp

I have only included the relevant parts of both of these files as they are quite long.  I have not even mentioned the word far in my definition.


#include <complex.h>
extern complex *arrayread (char *filename, int    num_elem);
int main()
{
...
...
complex *x;
char* filename;
unsigned int numpointsx;

cout << endl << "Filename?";
cin >> filename;
x = arrayread(filename, numpointsx);
....
....
}


The arrayread function is in a seperate node.

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include <complex.h>

complex *arrayread (char *filename, int *num_elem)
{
      int i=0,j;
      complex *data;
      char buffer[10];
      double tempd;

      fstream file;
      file.open (filename, ios::in );

      while (!file.eof())
      {
            i++;
            file.getline(buffer,10);
            cout << buffer << endl;
      }
      file.close();
      file.open (filename, ios::in );

      data = new complex[i];
      for (j=0; j<i; j++)  // loop reads in data
            {
            file.getline(buffer,10);
            sscanf(buffer,"%lf",&tempd);
            data[j]=tempd;
            }
      file.close();

      *num_elem = i;
      return data;
}


I hope all the information that I have given is sufficient.  If you need any more then please let me know.
0
Comment
Question by:DavidZ021497
1 Comment
 
LVL 1

Accepted Solution

by:
edtmihu earned 50 total points
ID: 1162265
The function is implemented as :
complex *arrayread (char *filename, int *num_elem)
but refered to as :
extern complex *arrayread (char *filename, int num_elem);
the problem is the num_elem parameter.
Change the forward declaration to:
complex *arrayread (char *filename, int *num_elem);

0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 102
Problem with SqlConnection 4 170
Which Linux flavors will this run on? 6 88
Android development question 2 37
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question