Author Topic: a warning Unused variable causes an error ?!?!? think it is a gcc configurationd  (Read 13625 times)

Offline rv2931

  • Multiple posting newcomer
  • *
  • Posts: 13
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 :

Code: [Select]
#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 :

Code: [Select]
#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


Offline rv2931

  • Multiple posting newcomer
  • *
  • Posts: 13
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

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
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:
Quote
Because 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"

Offline rv2931

  • Multiple posting newcomer
  • *
  • Posts: 13
great Thanks It works

 :lol: