News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

a warning Unused variable causes an error ?!?!? think it is a gcc configurationd

Started by rv2931, January 18, 2009, 11:59:41 PM

Previous topic - Next topic

rv2931

Hello, I have an error when I have a Warning : unused variable. I really don't understand why the compiler show that is a Warning and why it takes it for an error ??????

when I compil this code :

#include <QApplication>
#include <QFont>
#include <QMainWindow>
#include "Graph.h"

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QMainWindow *window=new QMainWindow();
    Graph* gr=new Graph(window);
    window->show();

    return app.exec();
}


I have this messages :
Quote/home/rv/Bureau/Qt/CustomWidgets/Graph01/main.cpp||In function «int main(int, char**)»:|
/home/rv/Bureau/Qt/CustomWidgets/Graph01/main.cpp|10|attention : unused variable «gr»|
||=== Build finished: 1 errors, 0 warnings ===|

and when I compil this one :

#include <QApplication>
#include <QFont>
#include <QMainWindow>
#include "Graph.h"

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QMainWindow *window=new QMainWindow();
    Graph* gr=new Graph(window);
    gr->y();
    window->show();

    return app.exec();
}


Quote
-------------- Build: Release in Graph01 ---------------

Compiling: main.cpp
Linking executable: release/Graph01
Output size is 20,09 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

I think it is due to a bad configuration of gcc in Code::Blocks but I don't see which option causes this behaviour

thanks

RV


rv2931

This behaviour could be due to the fact that the result of the compilation give "attention" in french and not Warning in a good english if I understand
...:o(

how to change that ???....
rv

Jenna

Quote from: rv2931 on January 19, 2009, 01:13:19 AM
This behaviour could be due to the fact that the result of the compilation give "attention" in french and not Warning in a good english if I understand
...:o(

how to change that ???....
rv

As I posted in the thread I linked to:
QuoteBecause of this problem I use the envvar-plugin to set "LC_ALL" to "en_US.UTF-8" ("Settings.. -> Environment -> Environment variables").

I don't want to change the regexes, what's also possible, but much more work and of course more error-prone. And it depends on the translation, that is available for your compiler.
"Settings -> Compiler and debugger... -> Global compiler settings... -> Other settings -> Advanced options... -> Output parsing"