Author Topic: struct  (Read 916 times)

choasforages

  • VIP
  • Member
  • ***
  • Posts: 1,729
  • Kudos: 7
    • http://it died
struct
« on: 4 October 2002, 04:48 »
ok, i have a struct

and i also have a multifile c++ project. now, how would i go about have functions in the other files accessing the struct i have declared globally in the first file, i tried sticking it in the header, but that didn't work. and idea
x86: a hack on a hack of a hackway
alpha, hewlett packed it A-way
ppc: the fruity way
mips: the graphical way
sparc: the sunny way
4:20.....forget the DMCA for a while!!!

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
struct
« Reply #1 on: 4 October 2002, 04:58 »
This may be a stupid question but are you including your header in the top of each of your *.cpp files (#include "myheader.h")?

http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20069209.html
http://mail.gnome.org/archives/gnome-devel-list/2001-July/msg00009.html

[ October 03, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

choasforages

  • VIP
  • Member
  • ***
  • Posts: 1,729
  • Kudos: 7
    • http://it died
struct
« Reply #2 on: 5 October 2002, 00:07 »
yup, and i got smart and prototyped everything in the header also. so i can use every function in each file. but i need to be able to write to the struct. and the error is something says something like multiple definitions of struct or somthing like that. ill have to try agian
x86: a hack on a hack of a hackway
alpha, hewlett packed it A-way
ppc: the fruity way
mips: the graphical way
sparc: the sunny way
4:20.....forget the DMCA for a while!!!

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
struct
« Reply #3 on: 5 October 2002, 00:13 »
Did you put the "#ifdef" statements in the header?
Someone please remove this account. Thanks...

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
struct
« Reply #4 on: 5 October 2002, 02:49 »
Am reading the structs chapter as am typing this. If i find an answer ill post it.
Yeah