Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Can't solve a linking error

Posted on 1997-02-26
1
Medium Priority
?
220 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.
Suggested Courses

877 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