www.digitalmars.com         C & C++   DMDScript  

c++ - Linker error? - fraction.zip

reply Mel <Mel_member pathlink.com> writes:
I just recently started to re-teach myself C++ after a few years, so many it's
just a stupid error on my part.  (If so, permission to
correct/scold/flame/beat/shoot me is freely granted)

Anyway, here are my the contents of my three files:

***************************************
//driver.cpp
#include "fraction.h"

int main()
{
Fraction a;
a.doNothing();
return 0;
}

***************************************
//fraction.cpp
#include "fraction.h"

void Fraction::doNothing()
{
}

***************************************
//fraction.h
#ifndef __FRACTION_H
#define __FRACTION_H

class Fraction
{
public:
void doNothing();
};

#endif

***************************************

After running "dmc driver", I get the following output:

link driver,,,user32+kernel32/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989-2001 All Rights Reserved

driver.obj(driver)
Error 42: Symbol Undefined ?doNothing Fraction  QAEXXZ (void syscall
Fraction::doNothing( void ))

--- errorlevel 1

The only reason I can think of is that maybe my system's Japanese configuration
is throwing something off ( '\' is always displayed as a yen symbol).  Anyone
have any ideas?

Thanks in advance,
Mel


begin 0644 fraction.zip

M*4U)55!**TI,+LG,S]/+4.+EXN7*S"M1R$W,S-/0Y.6JYN7B=(-**R1:`WF)
M>BGY?ODE&9EYZ1J:((&BU)+2HCP%`R"[% !02P,$%````` `MH%0-//#Z!!:
M````; ````H```!F<F%C=&EO;BYH4\Y,RTM)35.(CW<+<G0.\?3WB_? Y5(&
M"F7FI:*)\G(EYR06%RNX%24FEV3FY_%R58,$"TJ3<C*3K7BY.,OR,U,44O+]

M```,````9G)A8W1I;VXN8W!P4\[,2\XI34E54$HK2DPNR<S/T\M0XN7BY2K+
MSTQ1<(.*65FEY/OEEV1DYJ5K:/)R5?-RU0(`4$L!`A0+%````` `-HA0-.(-
M>6-,````5`````H``````````0` `````````&1R:79E<BYC<'!02P$"%`L4
M````"`"V 5`T\\/H$%H```!N````" `````````!`"````!T````9G)A8W1I

G`/8```!F<F%C=&EO;BYC<'!02P4&``````,``P"J````5 $`````
`
end
Feb 16 2006
next sibling parent "Walter Bright" <newshound digitalmars.com> writes:
You need to compile fraction.cpp and link it in, too.

"Mel" <Mel_member pathlink.com> wrote in message 
news:dt37vh$1m8a$1 digitaldaemon.com...
 link driver,,,user32+kernel32/noi;
 OPTLINK (R) for Win32 Release 7.50B1
 Copyright (C) Digital Mars 1989-2001 All Rights Reserved

 driver.obj(driver)
 Error 42: Symbol Undefined ?doNothing Fraction  QAEXXZ (void syscall
 Fraction::doNothing( void ))
Feb 16 2006
prev sibling parent Bertel Brander <bertel post4.tele.dk> writes:
Mel wrote:
 I just recently started to re-teach myself C++ after a few years, so many it's
 just a stupid error on my part.  (If so, permission to
 correct/scold/flame/beat/shoot me is freely granted)
 
Just compile it all at once: dmc driver.cpp fraction.cpp -omyprog.exe Which will create myprog.exe -- Absolutely not the best homepage on the net: http://home20.inet.tele.dk/midgaard But it's mine - Bertel
Feb 17 2006