User forums > Using Code::Blocks

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

(1/1)

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 :


--- 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();
}
--- End code ---

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

--- End quote ---

and when I compil this one :


--- 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);
    gr->y();
    window->show();

    return app.exec();
}
--- End code ---


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

--- End quote ---

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

Jenna:
Maybe this helps: http://forums.codeblocks.org/index.php/topic,9489.0.html .

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

--- End quote ---

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"
--- End quote ---

rv2931:
great Thanks It works

 :lol:

Navigation

[0] Message Index

Go to full version