Miscellaneous > Programming & Networking

struct

(1/1)

choasforages:
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

voidmain:
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 ]

choasforages:
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

voidmain:
Did you put the "#ifdef" statements in the header?

Bazoukas:
Am reading the structs chapter as am typing this. If i find an answer ill post it.

Navigation

[0] Message Index

Go to full version