Solved

Can't solve a linking error

Posted on 1997-02-26
1
194 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now