Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: choasforages on 4 October 2002, 04:48

Title: struct
Post by: choasforages 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
Title: struct
Post by: voidmain 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://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20069209.html)
http://mail.gnome.org/archives/gnome-devel-list/2001-July/msg00009.html (http://mail.gnome.org/archives/gnome-devel-list/2001-July/msg00009.html)

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

Title: struct
Post by: choasforages 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
Title: struct
Post by: voidmain on 5 October 2002, 00:13
Did you put the "#ifdef" statements in the header?
Title: struct
Post by: Bazoukas on 5 October 2002, 02:49
Am reading the structs chapter as am typing this. If i find an answer ill post it.