compiler-warnings

gcc warning: function used but not defined

放肆的年华 提交于 2020-02-17 23:02:17
问题 I am getting the warning: function used but not defined . I have static __inline__ in header file say a.h . The header file is included in a.c . I would like put all those inline function which are in header files into the .c files. Following code gives the idea of my problem. Orginal code: a.h: static __inline__ function1(){ function definition; } I changed: a.h: static function1(); a.c: #include "a.h" static function1(){ function definition; } On doing above I got the warning: warning:

gcc warning: function used but not defined

那年仲夏 提交于 2020-02-17 22:59:36
问题 I am getting the warning: function used but not defined . I have static __inline__ in header file say a.h . The header file is included in a.c . I would like put all those inline function which are in header files into the .c files. Following code gives the idea of my problem. Orginal code: a.h: static __inline__ function1(){ function definition; } I changed: a.h: static function1(); a.c: #include "a.h" static function1(){ function definition; } On doing above I got the warning: warning:

Warning on comparing a SmallInt with result of Ord function

陌路散爱 提交于 2020-02-15 04:42:40
问题 I'm comparing a SmallInt variable with the result of the Ord function. Example: var MySmallInt : SmallInt; begin MySmallInt := 5; if(MySmallInt > Ord('C')) then ShowMessage('True') else ShowMessage('False'); end After doing this, the following warning message is shown (W1023): W1023 Comparing signed and unsigned types - widened both operands Delphi's hint on the Ord function says that it should return a SmallInt and that's why I can't understand what causes the warning message. (I've looked

Warning on comparing a SmallInt with result of Ord function

末鹿安然 提交于 2020-02-15 04:39:38
问题 I'm comparing a SmallInt variable with the result of the Ord function. Example: var MySmallInt : SmallInt; begin MySmallInt := 5; if(MySmallInt > Ord('C')) then ShowMessage('True') else ShowMessage('False'); end After doing this, the following warning message is shown (W1023): W1023 Comparing signed and unsigned types - widened both operands Delphi's hint on the Ord function says that it should return a SmallInt and that's why I can't understand what causes the warning message. (I've looked

How to suppress warnings in Qt Creator

大憨熊 提交于 2020-02-01 03:09:46
问题 I'm wondering if it is possible to suppress compiler specific warnings in Qt-Creator. My g++-4.5 prints: warning: enumeral and non-enumeral type in conditional expression I would like to get rid of it, because it's very annoying. Ubuntu 11.04 x64 g++-4.5 QtCreator 2.01 Qt 4.7 Thank you! 回答1: You need to use this: QMAKE_CXXFLAGS += -Wno-enum-compare if you get a warning that ends in -Wenum-compare , for example. Also, note that some warnings cannot be suppressed as per the GCC documentation

Suppress “stack size cannot be dynamically determined” warnings?

半世苍凉 提交于 2020-01-25 10:21:07
问题 I'm getting a CUDA warning saying ptxas warning : Stack size for entry function '_Z13a_test_kernelv' cannot be statically determined. Now, I know what it means, and there's a SO question about why it happens. What I want to suppress the warning (when compiling with nvcc 10.x). Can I? If so, where exactly do I put the warning suppression #pragma for this? 回答1: Add -Xptxas -suppress-stack-size-warning when compiling with nvcc. 来源: https://stackoverflow.com/questions/59328507/suppress-stack-size

GCC Compiler options -wno-four-char-constants and -wno-multichar

試著忘記壹切 提交于 2020-01-23 11:48:08
问题 Couldn't find any documentation on -Wno-four-char-constants , however I suspect that it is similar to -Wno-multichar . Am I correct? 回答1: They're related but not the same thing. Compiling with the -Wall --pedantic flags, the assignment: int i = 'abc'; produces: warning: multi-character character constant [-Wmultichar] with both GCC and CLANG, while: int i = 'abcd'; produces: GCC warning: multi-character character constant [-Wmultichar] CLANG warning: multi-character character constant [-Wfour

how to supress warning “gets() is deprecated”? [duplicate]

落花浮王杯 提交于 2020-01-21 05:17:25
问题 This question already has answers here : Disable warning messages in GCC through header files? (10 answers) Closed 5 years ago . everytime i try to input my string using gets() function, my compiler gives me warning like shown below. how to get rid of this. what am i doing wrong? test.c:27:2: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(temp); ^ 回答1: Use fgets instead: fgets(temp, sizeof(temp), stdin); gets is deprecated because it's

“Call Stack” for C++ errors in Visual Studio 2005

我与影子孤独终老i 提交于 2020-01-16 09:44:30
问题 Is there a "call stack" for compiler errors in Visual Studio 2005 (C++)? For example, I am using a boost::scoped_ptr as the value in a QHash. This is however causing the following compile error: 1>c:\qt\include\qtcore\../../src/corelib/tools/qhash.h(743) : error C2248: 'boost::scoped_ptr<T>::operator =' : cannot access private member declared in class 'boost::scoped_ptr<T>' From the build output I know which of my source files is causing the error and the line number in the qhash.h that is

GCC -Wunused-function not working (but other warnings are working)

回眸只為那壹抹淺笑 提交于 2020-01-14 10:14:53
问题 I'm trying to find unused functions in my codebase by using GCC's -Wunused-function flag. As I would expect, compiling the below code with gcc -Wall -Wunused-function main.cpp prints an unused variable warning: warning: unused variable ‘x’ [-Wunused-variable] However, the compiler doesn't give an unused-function warning. What do I have to do to make GCC notice the unused function foo() ? // main.cpp void foo(){ } //should (but doesn't) trigger 'unused function' warning int main (int argc,