Hi all,

My cpp is rusty as all get out and I'm wondering why this doesn't seem to work. I've basically created a .cpp file with all of the structs and lower level data types in it. One of these is an enumerated type. The file. structs.cpp is as follows:

#include <cstdlib>

using namespace std;

struct pos
       int x;
       int y;
       pos(int i, int j) 
               x = i;
               y = j;

enum Resources {wood, stone, metal, crops, animals, none};

My compiler is Dev-C++ v4.9.9.2 for windows. Other files that include structs.cpp can see the pos struct (or any other struct for that matter) but nobody can see the enumerated type. The same applies if I place it in my main.cpp before

int main(int argc, char *argv[])

Since the pos struct is visible, why isn't the enum? anyone? (I can workaround to just create a struct to contain the enumerated data and assign name value pairs but - I am curious as to why enums don't work. Thanks!

Umm, false alarm. That is exactly how it's done.

Hi i tried ur code, i couldent get it to even see the pos struct with 2 cpp files (as i expected) so i made the above code as a .h file and then added a #include to it in the main and then it allowed me to use the resource and displayed the tooltip for it etc

I have my project files attached

I hope this is what you were looking for if not can you ellaborate on the problem? as i think i can help you

Cool thanks a lot! I thought of doing that as well. I actually wound up doing just that and creating the structs objects as their own class, just like any other. That's what I should have done in the first place. OOP is all about where you put things. For the IDE, I think you're right. The tooltips and gui extensions are grabbing their meta-data either from global structures defined in main or your header files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.