I am getting a pair of warnings with version 2.22 of glibc:
In file included from /net/module/sw/glibc/2.22/include/pthread.h:23:0,
from foo.h:48,
from foo.c:23:
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: ‘struct timespec’ declared inside parameter list
extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
^
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from foo.h:48:0,
from foo.c:23:
/net/module/sw/glibc/2.22/include/pthread.h:1002:21: warning: ‘struct timespec’ declared inside parameter list
const struct timespec *__restrict __abstime)
^
And:
In file included from /net/module/sw/glibc/2.22/include/sys/param.h:26:0,
from foo.h:51,
from foo.c:23:
/net/module/sw/glibc/2.22/include/limits.h:123:3: warning: #include_next is a GCC extension
# include_next <limits.h>
^
I am using GCC 5.3.0 with this version of glibc.
Since these warnings are referencing an external library I do not control, can I safely ignore these warnings if my application otherwise appears to pass tests?
My concern is that these warnings (particularly those related to pthread) may indicate the introduction of subtle bugs that I do not have tests to catch.
Yes, these warnings should be harmless, but the struct timespec warning is certainly odd. Usually, they would be masked by GCC's warning suppression for system headers.
Related
I am trying to build libssh2 using cmake. I have downloaded current master commit cfe0bf64985fd6a5db3b45ffc31a2fe3b8fd9948. When I run the build command, I get this compile error:
extern/libssh2/src/libssh2_priv.h:907:38: error: array type has incomplete element type ‘struct iovec’
const struct iovec datavec[], void **abstract);
^~~~~~~
I am using a debian 10.6 machine and my gcc version is 8.3.0.
There was a colon in the path and removing it solved the problem.
Next question: Why it didn't make any problem to build C++ apps?
I was trying to compile Asterisk 1.6 on Windows using Cygwin
1- I have installed Cygwin and included (Debug, Devel and Libs )while installing Cygwin.
2- ./Configure passed successfully
3- while running make command I got this
In file included from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27:0,
from smsq.c:20:
/home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:205:28: error: conflicting types for ‘uint64_t’
typedef unsigned long long uint64_t;
^
In file included from /usr/include/stdint.h:14:0,
from /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/stdint.h:9,
from /usr/include/inttypes.h:19,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk/compat.h:29,
from /home/Administrator/asterisk-1.6.2.24/include/asterisk.h:27,
from smsq.c:20:
/usr/include/sys/_stdint.h:60:20: note: previous declaration of ‘uint64_t’ was here
typedef __uint64_t uint64_t ;
^
make[1]: *** [/home/Administrator/asterisk-1.6.2.24/Makefile.rules:91: smsq.o] Error 1
make: *** [Makefile:422: utils] Error 2
I need to know what is the cause and how can I fix this issue?
Thanks in advance
The type named uint64_t is defined in <stdint.h> where it should be, but asterisk is (wrongly, all identifiers ending in _t are reserved names) trying to provide its own definition.
Remove the improper definition in "compat.h".
I work on a small open source pc timer project. I'd love to get my client working on OS X, but I can even get it to launch! I installed xcode, and the qt5 sdk with qtcreator. When I compile I get the following warnings, but the binary compiles:
/Users/kylehall/Documents/Libki/main.cpp:25: In file included from ../Libki/main.cpp:25:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
/Users/kylehall/Documents/Libki/timerwindow.cpp:21: In file included from ../Libki/timerwindow.cpp:21:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
/Users/kylehall/Documents/build-Libki-Desktop_Qt_5_2_1_clang_64bit-Debug/moc_timerwindow.cpp:9: In file included from moc_timerwindow.cpp:9:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
When I try to run the binary I get the following error:
dyld: Library not loaded: /work/build/______________________________PADDING______________________________/lib/QtPositioning.framework/Versions/5/QtPositioning
Referenced from: /Users/kylehall/Documents/build-Libki-Desktop_Qt_5_2_1_clang_64bit-Debug/libkiclient.app/Contents/MacOS/libkiclient
Reason: image not found
Debugging has finished
At this point I don't even know where to begin with such a cryptic error. Any suggestions would be great! You can grab the code and try compiling it yourself from https://bitbucket.org/libki-kms/libki-client/src
Seems pretty clear:
warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
So you must have:
#ifndef TIMERWINDOW_H
#define LOGINWINDOW_H
Copy and paste error, I'd say...
I am building project which based on C++11 so it needed at least GCC 4.7.2 which is not installed on my platform (and I dont have permission to upgrade software on it). So another option is to build the project with Clang and I downloaded and build CLang 3.5. On platform GCC 4.3.4 is preinstalled.
When I compiling the code I got a lot of errors like that one:
[ 88%] Building CXX object system/CMakeFiles/Grappa.dir/tasks/TaskingScheduler.cpp.o
cd /home/frolo/grappa/build/Make+Release/system && /home/frolo/llvm/build/Debug+Asserts/bin/clang++ -DENABLE_RDMA_AGGREGATOR -DGASNET_CONDUIT_IBV -DGASNET_IBV -DGASNET_SEQ -DSHMMAX=1844674407
3709551615 -std=c++11 -Winline -Wno-inline -mno-red-zone -O3 -g -I/home/frolo/grappa/build/Make+Release/third-party/include -I/home/frolo/grappa/build/Make+Release/third-party/include/ibv-condu
it -I/usr/mpi/gcc/openmpi-1.6.4/include -I/home/frolo/grappa/system -I/home/frolo/grappa/system/tasks -o CMakeFiles/Grappa.dir/tasks/TaskingScheduler.cpp.o -c /home/frolo/grappa/system/tasks
/TaskingScheduler.cpp
In file included from /home/frolo/grappa/system/Barrier.cpp:24:
In file included from /home/frolo/grappa/system/Barrier.hpp:26:
In file included from /home/frolo/grappa/system/ConditionVariable.hpp:27:
In file included from /home/frolo/grappa/system/Message.hpp:27:
In file included from /home/frolo/grappa/system/MessageBase.hpp:33:
In file included from /home/frolo/grappa/system/ConditionVariableLocal.hpp:27:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25: error: no matching constructor for initialization of 'std::ofstream' (aka 'basic_ofstream<char>')
std::ofstream f(FLAGS_stats_blob_filename);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:571:7: note: candidate constructor not viable: no known conversion from '::fLS::clstring' (aka 'basic_string<char>') to
'const char *' for 1st argument
basic_ofstream(const char* __s,
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/bits/fstream.tcc:916:25: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '::fLS
::clstring' (aka 'basic_string<char>') to 'const std::basic_ofstream<char>' for 1st argument
extern template class basic_ofstream<char>;
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:556:7: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
basic_ofstream(): __ostream_type(), _M_filebuf()
^
In file included from /home/frolo/grappa/system/IncoherentAcquirer.cpp:24:
In file included from /home/frolo/grappa/system/IncoherentAcquirer.hpp:28:
In file included from /home/frolo/grappa/system/Message.hpp:27:
In file included from /home/frolo/grappa/system/MessageBase.hpp:33:
In file included from /home/frolo/grappa/system/ConditionVariableLocal.hpp:27:
/home/frolo/grappa/system/tasks/TaskingScheduler.hpp:178:25: error: no matching constructor for initialization of 'std::ofstream' (aka 'basic_ofstream<char>')
std::ofstream f(FLAGS_stats_blob_filename);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/fstream:571:7: note: candidate constructor not viable: no known conversion from '::fLS::clstring' (aka 'basic_string<char>') to
'const char *' for 1st argument
basic_ofstream(const char* __s,
^
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/bits/fstream.tcc:916:25: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '::fLS
::clstring' (aka 'basic_string<char>') to 'const std::basic_ofstream<char>' for 1st argument
extern template class basic_ofstream<char>;
...
It looks like incompatibility between gcc 4.3.4 and clang 3.5, does not it? I am not an experienced user of clang, what can be done here to mend it?
Thank you for any help!
Best,
Alex
Clang 3.5 uses the gcc 4.7 ABI so you should compile with gcc >= 4.7. Alternatively, you can download nightly LLVM/Clang builds in .deb format for Ubuntu/Debian based Linux distros from this site.
Turning to Stack Overflow after exhausting all my efforts.
I'm running Code Blocks 13.12 and MinGW 4.8.1 on a Windows 7 OS 64bit system. I spent two days trying to get the compiler to link (statically) to the SFML 2.1 library. I followed both the SFML tutorial and this video tutorial- reinstalling both Code Blocks and MinGW twice before it finally linked.
After that I was relieved that SFML was recognized, but I got 50 errors when I tried to build and run that suggested C++11 features weren't.
Added -std=gnu++11 to compiler options and 13 of those errors went away.
The remaining errors all fall into two categories: mutex is not a member of std and from time t is not a member of chrono::_V2::steady clock. I'm not even sure what _V2 is.
What am I missing?
-------------- Build: Release in PumpTracker2.0 (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -std=gnu++11 -DSFML_STATIC -O2 -std=gnu++11 -IC:\SFML-2.1\include -IC:\SFML-2.1\include -c C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp -o obj\Release\main.o
In file included from C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:25:0:
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:37:1: error: 'mutex' in namespace 'std' does not name a type
std::mutex mu;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:86:22: error: 'to_time_t' is not a member of 'std::chrono::_V2::steady_clock'
time_t currentTp = std::chrono::steady_clock::to_time_t(newly);
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\Account.h:94:48: error: 'from_time_t' is not a member of 'std::chrono::_V2::steady_clock'
std::chrono::steady_clock::time_point tNew = std::chrono::steady_clock::from_time_t(currentTp);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:51:2: error: 'mutex' is not a member of 'std'
std::mutex mu3;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:51:13: error: expected ';' before 'mu3'
std::mutex mu3;
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:19: error: 'mutex' was not declared in this scope
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:24: error: template argument 1 is invalid
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:52:33: error: invalid type in declaration before '(' token
std::unique_lock<mutex> locker3(mu3, std::defer_lock);
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:214:22: error: 'to_time_t' is not a member of 'std::chrono::_V2::steady_clock'
pS->tpNewest = std::chrono::steady_clock::to_time_t(NextPump);
^
C:\Users\WITcom\Desktop\C++\PumpTracker2.0\main.cpp:245:51: error: 'from_time_t' is not a member of 'std::chrono::_V2::steady_clock'
std::chrono::steady_clock::time_point TT2 = std::chrono::steady_clock::from_time_t(pS->tpNewest);
^
Process terminated with status 1 (0 minute(s), 4 second(s))
37 error(s), 47 warning(s) (0 minute(s), 4 second(s))
As already mentioned the original MinGW distribution is not the best one to go with, if you want to go with up-to-date features. Instead there are projects like Nuwen (Stephan T. Lavavej's website) as well as MinGW Builds that provide MinGW-w64 binaries.
The mentioning of SFML is misleading, since the problems have nothing to do with SFML at all. Keep in mind however that you'll have to rebuild SFML if you change the compiler!
As a next step, it would've been important to post a minimal example of the source code that reproduces the errors, because right now, we can only guess what's going wrong, based on the errors.
If you don't use the GNU extensions explicitly, you should use -std=c++11 instead of -std=gnu++11 and if you look at the build command, you'll notice that it's included twice, which is not necessary.
And now to some guessing about the errors:
Account.h - Make sure the <mutex> header is included.
main.cpp - Make sure the <mutex> header is included.
main.cpp - If std::unique_lock<mutex> is from your code, then you need to add std::, i.e. std::unique_lock<std::mutex>.
main.cpp - time_t things seem to be resolved, but make sure anyways to include <chrono> and <ctime> (since time_t is defined in <ctime>).