delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/27/22:37:22

From: Radha Kotamarti <rkotamar AT u DOT washington DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Strange compile-time error
Date: Thu, 26 Mar 1998 21:23:43 +0000
Organization: University of Washington
Lines: 129
Message-ID: <351AC75F.E4329B26@u.washington.edu>
Reply-To: rkotamar AT u DOT washington DOT edu
NNTP-Posting-Host: cs211-29.student.washington.edu
Mime-Version: 1.0
CC: rkotamar AT u DOT washington DOT edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is a multi-part message in MIME format.
--------------52953BB35E2DF41509608B5B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I'm experiencing a strange error when I try to compile a file that
includes one other file located in the local directory (I'm including
the sources with this posting). Here's how I invoke the compiler and the
output I'm getting:

[C:/complex_test/complex/complexlib] gcc complex.C -o complexlib.a
c:/djgpp/lib\crt0.o(.data+0x92):crt0.s: undefined reference to `main'
c:/djgpp/lib/libc.a(crt1.o)(.text+0x312):crt1.c: undefined reference to
`main'

I also get the same message when I use gxx instead of gcc. I've tried
compiling from both the MS-DOS shell and from MKS Korn shell with the
same results. I'm running NT4.0 and have disabled LFN (lfn=n). Any help
would be greatly appreciated. Please cc my email.

Incidentally, I have successfully compiled and linked simple "hello
world" type programs.

Oh, here are are the sources:

Thanks in advance for any help.

radha
--
--------------------------------------------------
Radha Kotamarti
Department of Electrical Engineering
University of Washington, Seattle

Email:rkotamar AT u DOT washington DOT edu
--------------------------------------------------


--------------52953BB35E2DF41509608B5B
Content-Type: text/plain; charset=us-ascii; name="complex.C"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="complex.C"

#if __GNUG__ >= 2
#  pragma implementation
#endif

#include <stdio.h>
#include "complex.h"


//---- complex ---------------------------------------------------------

float complex::GetReal() 
{

	return(re);
}

float complex::GetIm() 
{

	return(im);
}

void complex::Set(float r, float i ) 
{
	re = r ;
	im = r;
}


void complex::SetReal(float r ) 
{
	re = r ;
}



void complex::SetIm(float i) 
{
	im =i ;
}


void complex::Print() 
{
	printf("Real=%f, Im=%f\n", re, im );
}


--------------52953BB35E2DF41509608B5B
Content-Type: text/plain; charset=us-ascii; name="complex.h"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="complex.h"

//-*-Mode: C++;-*-
#ifndef _complex_h_
#define _complex_h_

#if __GNUG__ >= 2
#  pragma interface
#endif


//---- complex -----------------------------------------------------------

class complex
{
	float re;
	float im;
public:

	float GetReal();
	float GetIm();
	void Set(float r, float i );
	void SetReal(float r );
	void SetIm(float i);
	
	void Print();

};

#endif

--------------52953BB35E2DF41509608B5B--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019