How do you disable the unused variable warnings coming out of gcc in 3rd party code I do not wish to edit?

The -Wno-unused-variable switch usually does the trick. However, that is a very useful warning indeed if you care about these things in your project. It becomes annoying when GCC starts to warn you about things not in your code though. I would recommend you keeping the warning on, but use -isystem instead of -I for … Read more

Difference between -pthread and -lpthread while compiling

-pthread tells the compiler to link in the pthread library as well as configure the compilation for threads. For example, the following shows the macros that get defined when the -pthread option gets used on the GCC package installed on my Ubuntu machine: $ gcc -pthread -E -dM test.c > dm.pthread.txt $ gcc -E -dM … Read more

What are the useful GCC flags for C?

Here are mine: -Wextra, -Wall: essential. -Wfloat-equal: useful because usually testing floating-point numbers for equality is bad. -Wundef: warn if an uninitialized identifier is evaluated in an #if directive. -Wshadow: warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed. -Wpointer-arith: warn if anything depends … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)