I\'m a bit new to c++ and I have a coding assignment with a lot of files already done, but I noticed that VS2012 seems to have an issue with the following statement:
uint32_t
(aka ::uint32_t
i.e. the one in the global namespace) is declared in
. That header might also declare it in namespace std
, as std::uint32_t
, but it's not required to do so.
std::uint32_t
(i.e. the one in namespace std
) is declared in
. That header might also declare it in the global namespace, as ::uint32_t
, but it's not required to do so.
If that's the case, why is this code acceptable outside of VS (ie. compiles properly using g++) but is unacceptable in VS? Can anyone please explain this?
If you want to use std::uint32_t
then you must #include
, or the code may not compile. If it does compile with G++ then presumably some other header indirectly includes
but you shouldn't rely on that, include the right headers for the names you use.