Solved

Can't solve a linking error

Posted on 1997-02-26
1
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

740 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