This topic is now archived and is closed to further replies.

Make a variabele available to all cpp files

This topic is 5796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ATM I have a file named main.cpp, which includes the header main.h I want to divide main.cpp in different parts now, so I made different cpp files which all store a few functions. 1 for text, 1 for initializing everything, etc. the problem is, I need a variabele in text.cpp now which I made in main.h, which is included in main.cpp I want the variabele to be available in the other cpp file too. How do I do this? It would be even better if there was a way to include all the variabeles in all the files if that''s possible... I tried including the main.h file in the other documents, but this doesn''t work because it tries to re-make the variabeles... Or am I doing something wrong?

Share this post

Link to post
Share on other sites