Jump to content
  • Advertisement

Archived

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

Arek the Absolute

constants in multiple source files

This topic is 5739 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

Why is it I''m having so much trouble with something like this silly? I must be getting tired and just forgetting something stupid. Anyway, my problem is using G++ for a GBA application, but this isn''t GBA specific. In one source file I have something like this: const int array[5] = {0,1,2,3,4}; and in another source file I have this: extern const int array[5]; and whenever I try to use the array in that other source file (the one that defines it as extern) the linker tells me I have an "undefined reference to ''array''" If I make the variable simply an int, (not const) then everything works fine. It''s real important that I make sure this array is constant, so what am I missing here? There''s got to be a way to share const arrays between multiple source files... -Arek the Absolute

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!