Closed eivindro closed 10 years ago
Please see if the latest push to tip helps.
Trying to get it working on Windows. Same results than original poster with the latest push.
Is that the full error or is there any other warning before that?
Got it!
Turns out one has to write class in front of ShowWindow, like so:
reinterpret_cast<class ShowWindow *>(win)->show();
This is probably because there is a global function called ShowWindow defined in the Win32 API which naturally is available when using mingw, I have to admit that ShowWindow is an extraordinary bad name for a class (it sounds like a function), it just shows that you have to be careful when naming variables in C/C++ even when they're internal.
To me it shows that C++ is extraordinarily bad at namespacing and error reporting.
Thanks for figuring it out.
Maybe a case for blaming the compiler instead. In the past, building Qt with clang I got trivial errors that go unnoticed with g++ (let's not even talk about msvc). I got better error messages and it even provided fix suggestions...
just to compare
code
void x(){}
struct x{};
int main()
{
reinterpret_cast<x *>(0);
}
clang 3.4
francisco@Ubuntu:~/Projetos/samples$ clang++ sample.cpp
sample.cpp:6:22: error: must use 'struct' tag to refer to type 'x' in this scope
reinterpret_cast<x *>(0);
^
struct
sample.cpp:1:6: note: struct 'x' is hidden by a non-type declaration of 'x' here
void x(){}
^
sample.cpp:6:5: warning: expression result unused [-Wunused-value]
reinterpret_cast<x *>(0);
^~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
gcc 4.8
francisco@Ubuntu:~/Projetos/samples$ g++ sample.cpp
sample.cpp: In function ‘int main()’:
sample.cpp:6:22: error: expected type-specifier before ‘x’
reinterpret_cast<x *>(0);
^
sample.cpp:6:22: error: expected ‘>’ before ‘x’
sample.cpp:6:22: error: expected ‘(’ before ‘x’
sample.cpp:6:25: error: expected primary-expression before ‘>’ token
reinterpret_cast<x *>(0);
^
sample.cpp:6:29: error: expected ‘)’ before ‘;’ token
reinterpret_cast<x *>(0);
^
I get this build error on windows/mingw compiler after commit e033ffcc21