Hello, I am having some serious difficulty trying to create a class in a header file. I have found that when using the #ifndef I will recieve an error message stating "unknown type name 'class'", however if I use #ifdef it will compile with no problem but has linking problems with main.cpp. I am using Dev C, and I was just wondering if anyone else has encountered this before and what they did to resolve it.

Thank you

Recommended Answers

Post the code you have.

Jump to Post

All 3 Replies

Post the code you have.

I can post the code that I have, although I don't believe it will help. I know the class works because when I paste it in the main.cpp file and ignore the #include"-----.h" it works perfectly. This seems like a compiler problem.

More then likely it is not. Post the code using the #ifndef that does not work.

Be a part of the DaniWeb community

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