2

I porting code from a windows machine to a Mac. I am using OS X 10.6 with Xcode 3.2.5

I have a header file called api.h which has the following code:

namespace ocip {
    #include "onan/ocip/ocip.h"
}

ocip.h includes #include stdint.h
which has the following typedef:

 typedef unsigned int         uint32_t;

Now back to api.h I have class with following in it:

ocip::uint32_t m_nMode;

The compiler tells me that uint32_t in namespace 'ocip' does not name a type.

Any ideas what I am doing wrong?

Michael Wildermuth
  • 5,762
  • 3
  • 29
  • 48

1 Answers1

0

I don't know if this will help, but a type of "uint32_t" may already be declared. There is already a typedef of the same name if you are including "stdint". This could be causing a problem with redefining it in opic.h.

Chris
  • 1,569
  • 2
  • 11
  • 18
  • I just realized that I left out that key word in my question, ocip.h includes stdint.h, which what I was hoping ocip::uint32_t would be. Does this mean that if I am including stdint.h that I can't use a namespace around it like I am trying in the question? – Michael Wildermuth Jul 25 '11 at 21:08
  • Everything inside stdint is in the std namespace. Try "ocip::std::uint32_t", but I think you might have to move the #include to outside the namespace declaration (before it), and then do "using namespace std" – Chris Jul 25 '11 at 21:14
  • It doesn't seems like uint32_t isn't in the std namespace since std::uint32_t doesn't work with or without ocip:: in front of it or with including using namespace std; When I look into stdint.h it doesn't have a namespace in it either. It still seems like ocip::uint32_t should work, but it doesn't – Michael Wildermuth Jul 25 '11 at 21:43
  • You're right. Do you have a slight misspelling? I understand that sounds stupid, but: http://www.daniweb.com/software-development/cpp/threads/215315 – Chris Jul 25 '11 at 21:53
  • This actually might help: http://stackoverflow.com/questions/1204118/can-i-include-iostream-header-file-into-custom-namespace – Chris Jul 25 '11 at 22:09
  • @MichaelWildermuth let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1813/discussion-between-chris-and-michael-wildermuth) – Chris Jul 25 '11 at 22:09