GithubHelp home page GithubHelp logo

Build error after commit e033ffcc21 about qml HOT 7 CLOSED

go-qml avatar go-qml commented on August 24, 2024
Build error after commit e033ffcc21

from qml.

Comments (7)

niemeyer avatar niemeyer commented on August 24, 2024

Please see if the latest push to tip helps.

from qml.

radisson avatar radisson commented on August 24, 2024

Trying to get it working on Windows. Same results than original poster with the latest push.

from qml.

niemeyer avatar niemeyer commented on August 24, 2024

Is that the full error or is there any other warning before that?

from qml.

eivindro avatar eivindro commented on August 24, 2024

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.

from qml.

niemeyer avatar niemeyer commented on August 24, 2024

To me it shows that C++ is extraordinarily bad at namespacing and error reporting.

Thanks for figuring it out.

from qml.

oblitum avatar oblitum commented on August 24, 2024

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...

from qml.

oblitum avatar oblitum commented on August 24, 2024

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);
                             ^

from qml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.