www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Linker error? - fraction.zip

↑ ↓ ← 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
Feb 16 2006
→ "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
→ 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