🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++.leda
Article #55

Tricky question (I think)

#55
From: Abhijit Devasthale
Date: Thu, 24 Aug 1995 03:44
36 lines
1364 bytes
When I compile the following program using g++ I get the errors listed below
the program :
--------------------------------
#include <iostream.h>

main()
{
   void LU(int, float[][55], float[][55], float[][55], float[]);
   void Display_lu(int, float[][55], float[][55], float[]);

   int n;
   float A[55][55], L[55][55], U[55][55], d[55];
   LU(n, L, A, U, d);
   Display_lu(n, L, U, d);
}
void LU(int n, float L[][55], float A[][55], float U[][55], float d[])
{
  cout << "HERE IN LU" << endl;
}
void Display_lu(int n, float L[][55], float U[][55], float d[])
{
  cout <<"HERE IN DISPLAY" << endl;
}
----------------------------------
Errors:
ld: Undefined symbol
  _LU__FiPA55_fPA55_fPA55_fPf
  _Display_lu__FiPA55_fPA55_fPf
collect: ld returned 2 exit status
---------------------------------

But if I write the two prototypes above main() then it compiles and executes
without any problem. So why do I have to make the functions global??
Any help is appreciated.

Abhijit.
Technical Details
Message-ID: <41gsif$1sa@eegradsrv.ee>
Path: arc1-ca.pugleaf.net!news.mtu.edu!not-for-mail

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mtu.edu!not-for-mail
From: adevasth@mtu.edu (Abhijit Devasthale)
Newsgroups: comp.lang.c++.leda
Subject: Tricky question (I think)
Date: 23 Aug 1995 23:44:15 -0400
Organization: Michigan Technological University
Message-ID: <41gsif$1sa@eegradsrv.ee>
NNTP-Posting-Host: eegradsrv.ee.mtu.edu
X-Newsreader: TIN [version 1.2 PL1]