Jump to content

Image of the Day

BL00DG0R3
#screenshotsaturday #gamedev #indiedev https://t.co/SytiLEa4G5
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Visual Studio 2008: 'W' is for WTF?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
8 replies to this topic

#1 KanonBaum   Members   

277
Like
0Likes
Like

Posted 16 October 2011 - 08:30 PM

Posted Image

It is saying there is not such member 'GetObjectW' for ObjectGroup when CLEARLY the only method being called is 'GetObject'

What.
I'm that imaginary number in the parabola of life.

#2 SiCrane   Moderators   

11665
Like
2Likes
Like

Posted 16 October 2011 - 08:32 PM

Does that file directly or indirectly include windows.h or any of the other Windows headers? If so then you're now experiencing the joy of preprocessor rewrites of your code.

#3 KanonBaum   Members   

277
Like
0Likes
Like

Posted 16 October 2011 - 09:37 PM

Nope.

Lemme get back to my work computer and throw the source up here for you to browse.
I'm that imaginary number in the parabola of life.

#4 fastcall22   Moderators   

10564
Like
2Likes
Like

Posted 16 October 2011 - 09:47 PM

You're definitely including a Windows header somewhere in this source file. Otherwise, you wouldn't get an error message since the Tmx::Object::GetObject would also be changed to Tmx::Object::GetObjectW. Therefore the Tmx::Object header is not including a Windows header and map.cpp (or one of its dependencies) is. See if /showIncludes shows anything suspicious.

Also, here's a quickfix:
#undef GetObject      // OMG TEH WIN32   D:<

zlib: eJzVVLsSAiEQ6/1qCwoK i7PxA/2S2zMOZljYB1TO ZG7OhUtiduH9egZQCJH9 KcJyo4Wq9t0/RXkKmjx+ cgU4FIMWHhKCU+o/Nx2R LEPgQWLtnfcErbiEl0u4 0UrMghhZewgYcptoEF42 YMj+Z1kg+bVvqxhyo17h nUf+h4b2W4bR4XO01TJ7 qFNzA7jjbxyL71Avh6Tv odnFk4hnxxAf4w6496Kd OgH7/RxC

#5 KanonBaum   Members   

277
Like
0Likes
Like

Posted 16 October 2011 - 10:39 PM

Did some research. Turns out the library I was using includes windows and it DOES in fact have a method named GetObject.

Using the quickfix before usage made it work. Thanks a bunch.

But WHY does Win32 DO that?? That's so messed up!
I'm that imaginary number in the parabola of life.

#6 shurcool   Members   

439
Like
0Likes
Like

Posted 16 October 2011 - 11:01 PM

They didn't consider the consequences of their decision hard enough at the time.

#7 SimonForsman   Members   

7619
Like
3Likes
Like

Posted 16 October 2011 - 11:42 PM

Did some research. Turns out the library I was using includes windows and it DOES in fact have a method named GetObject.

Using the quickfix before usage made it work. Thanks a bunch.

But WHY does Win32 DO that?? That's so messed up!


If you enable unicode support in your build windows.h automatically replaces a certain set of functions with their unicode equivalents and since its done using preprocessor macros they are effectivly just dumb text replacements (Which is one of the reasons why C++ macros are such an awful idea)

This problem exists for pretty much all functions in the Windows API.
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#8 Anon Mike   Members   

1098
Like
4Likes
Like

Posted 18 October 2011 - 10:20 AM

They didn't consider the consequences of their decision hard enough at the time.

at the time, the dominant language was C, not C++, so function overloading wasn't an option. They could have just made everyone call the W version directly, but then people would have whined about how dumb all the API names were (like you sometimes see for the unicode C-runtime functions, e.g. wcslen). Plus Microsoft was already fighting an uphill battle to get people to accept that Unicode was a good thing rather than a waste of memory (ASCII should be good enough for anybody!) And even the people who were willing to accept Unicode didn't want to have to go through their entire program changing function names - porting to NT (from Win16) was enough work already. Plus if they did that then it wouldn't compile for 16-bit anymore and that was where the real market was.

The macros were a perfectly reasonable compromise at the time. It is unfortunate that they don't provide a way to use overloading instead of macros for C++ nowadays, but I imagine there's little real benefit and it would very likely increase compile times in addition to making the headers simply bigger.
-Mike

#9 FableFox   Members   

696
Like
0Likes
Like

Posted 19 October 2011 - 05:42 AM

Learned new things today. Great reply, Anon Mike. +Like Posted Image
Fable Fox is Stronger <--- Fable Fox is Stronger Project




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.