Cannot convert ‘timeval*’ to ‘PTIMEVAL {aka __ms_timeval*}’ - boost

Getting this error during wxWidgets compilation for FileZilla on Windows10/MSYS2/Cygwin.
$ ./configure --prefix="$HOME/prefix" --enable-static --disable-shared
--build=x86_64-w64-mingw32 --enable-unicode --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin --disable-fsvolume
$ make
/home/alex_buz/wx3/bk-deps g++ -c -o netlib_socket.o -I./.pch/wxprec_netlib -D__WXMSW__ -DWXBUILDING -I./src/png -I./src/zlib -I./src/regex -I./src/expat/lib -DwxUSE_GUI=0 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/home/alex_buz/wx3/lib/wx/include/msw-unicode-static-3.0 -I./include -DWX_PRECOMP -O2 -fno-strict-aliasing ./src/common/socket.cpp
./src/common/socket.cpp: In member function ‘wxSocketEventFlags
wxSocketImpl::Select(wxSocketEventFlags, const timeval*)’:
./src/common/socket.cpp:1343:73: error: cannot convert ‘timeval*’ to ‘PTIMEVAL {aka __ms_timeval*}’ for argument ‘5’ to ‘int select(int, fd_set*, fd_set*, fd_set*, PTIMEVAL)’
const int rc = select(m_fd + 1, preadfds, pwritefds, &exceptfds, &tv);
^
make: *** [Makefile:29796: netlib_socket.o] Error 1
Google search gave some hints that it's related to boost.
Any way to resolve it?

Both values are different structures, because the members are of different type. Look at the definition code of them.
You cant convert them => make an instance and set the members.

Related

C++ template aliasing g++ 5.4

I'am not able to compile any trivial C++ aliasing declaration.
Here is my dev env :
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Here is my snippet (file tstFrameProd.cpp):
template<typename T = double>
struct mystruct {};
template<typename T = double> using myalias = mystruct<T>;
int main(int argc, char *argv[])
{
return 0;
}
Here is my compilation process :
g++ -g -std=c++11 -W -Wall -I../include -I../../../Toolbox/CShmRingBuf/ -I/opt/matrox_imaging/mil/include -Woverloaded-virtual -ansi -pipe -fno-for-scope -DGNU_GCC -DDEBUG -c -o tstFrameProd.o tstFrameProd.cpp
Here is my compilation error message :
tstFrameProd.cpp:20:31: error: expected unqualified-id before ‘using’
template<typename T = double> using myalias = mystruct<T>;
You're compiling with -ansi which negates the effect of -std=c++11. Simply remove it.

Undefined reference to sequence when trying to input a vector

This seems a simple but somehow the compile sends this error message which I'm not able understand thus correct my code.
This is a simplified version of what I did, just so it can appear the error for you:
Main.cpp
include "myfunction.h"
int main(){
std::vector<int> myVet = {1,4,3};
sequence(1,2,1,myVet);
}
myfunction.h
#include <vector>
/*funtion creates a sequence*/
void sequence(int start, int end,
int step, std::vector<int> skip);
myfunction.cpp
#include "myfunction.h"
void sequence(int start, int end,
int step, std::vector<int> skip){
auto x = 0;
};
This gives me an error message which says
In function 'main':
/home/machina/Documents/Grafos&Redes/Implementação/main.cpp:18: undefined reference to 'sequence(int, int, int, std::vector <int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status
Could you please explain me why it appears?
This is the following command which I've been using for compiling
g++ -std=c++11 -g -Wall -Wextra -Werror main.cpp -o main.out
You are only passing main.cpp to g++.
g++ needs to know about myfunction.cpp where your function is defined so as to compile and link it to your program.
The command to use should be:
g++ -std=c++11 -g -Wall -Wextra -Werror main.cpp myfunction.cpp -o main.out

gcc -Wextra warning comparison between signed and unsigned

I have started making use of the compiler options -Wall and -Wextra
Compiling my one .c file with -Wall I get no warnings.
for -Wextra I get just 3 warnings and they are for 123, 552, and 881 . At each of those lines the code is the same and is exactly this:
for ( index = 0; index < strlen(str); index++ )
with the warning issued by -Wextra being
mycode.c:123: warning: comparison between signed and unsigned
mycode.c:552: warning: comparison between signed and unsigned
mycode.c:881: warning: comparison between signed and unsigned
the variable index in the given functions is defined/declared locally as an int and I know strlen() provided by string.h returns type size_t
what is the best way to write that line of code so there is no warning message generated?

Unable to run "check-all" target when building LLVM-Clang 3.6.1

I have successfully compiled the 3.6.1 version of LLVM-Clang-LLDB-Compiler-RT-LibCxx-LibCxxABI-TestSuite bundle. However, when I tried ninja check-all, the check failed right at the first target [1/150] Generating sanitizer_bitvector_test.cc.x86_64.o. I think the reason is that LLVM is trying to use the system GCC header files, but I compiled LLVM with another GCC toolchain (GCC 4.8.4) that I compiled and installed in a non-root directory. However, I can't figure out how to let the CMake avoid using the system GCC headers (I have modified the PATH and LD_LIBRARY_PATH, but they didn't help at all).
Here is the relevant information:
CentOS 6.6
x86_64 architecture (Intel(R) Xeon(R) CPU W3550 # 3.07GHz)
Tools used for installation:
1) gcc/4.8.4
2) ninja
3) zlib/1.2.8
4) python-miniconda
Linux Kernel version
2.6.32-504.16.2.el6.x86_64
CMake build command
cmake -G "Ninja" -DCMAKE_C_COMPILER=/Scr/scr-test-steven/install/gcc/4.8.4/bin/gcc -DCMAKE_CXX_COMPILER=/Scr/scr-test-steven/install/gcc/4.8.4/bin/c++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Scr/scr-test-steven/install/llvm/3.6.1 /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src -DLLDB_DISABLE_PYTHON=1 -DCMAKE_CXX_FLAGS:STRING="-I/Scr/scr-test-steven/install/gcc/4.8.4/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/tools/clang/include -I/Scr/scr-test-steven/install/libedit/3.1/include -I/Scr/scr-test-steven/install/miniconda/include/python2.7 -L/Scr/scr-test-steven/install/gcc/4.8.4/lib64 -L/Scr/scr-test-steven/install/libedit/3.1/lib -L/Scr/scr-test-steven/install/miniconda/lib -L/Scr/scr-test-steven/install/miniconda/lib/python2.7" -DPYTHON_HOME=/Scr/scr-test-steven/install/miniconda -DLLVM_LIB_SEARCH_PATH=/Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/lib
ninja check results are okay, which means LLVM was compiled successfully:
[1/1] Running the LLVM regression tests
lit.py: lit.cfg:271: note: Did not find llvm-go in /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/./bin
-- Testing: 12316 tests, 8 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 105.65s
* Expected Passes : 12056
* Expected Failures : 79
* Unsupported Tests : 181
The first few lines of errors for ninja check-all (see details in Log.check.log ):
[1/150] Generating sanitizer_bitvector_test.cc.x86_64.o
FAILED: cd /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/projects/compiler-rt/lib/sanitizer_common/tests && /Scr/scr-test-steven/Programs/LLVM/build_llvm-3.6.1/./bin/clang -I/Scr/scr-test-steven/install/gcc/4.8.4/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/tools/clang/include -I/Scr/scr-test-steven/install/libedit/3.1/include -I/Scr/scr-test-steven/install/miniconda/include/python2.7 -L/Scr/scr-test-steven/install/gcc/4.8.4/lib64 -L/Scr/scr-test-steven/install/libedit/3.1/lib -L/Scr/scr-test-steven/install/miniconda/lib -L/Scr/scr-test-steven/install/miniconda/lib/python2.7 -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unknown-warning-option -DGTEST_NO_LLVM_RAW_OSTREAM=1 -DGTEST_HAS_RTTI=0 -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/include -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib -I/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common -fno-rtti -O2 -Werror=sign-compare -Wno-non-virtual-dtor -m64 -c -o sanitizer_bitvector_test.cc.x86_64.o /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc
clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/gcc/4.8.4/lib64'
clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/libedit/3.1/lib'
clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/miniconda/lib'
clang-3.6: warning: argument unused during compilation: '-L/Scr/scr-test-steven/install/miniconda/lib/python2.7'
In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cc:16:
In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h:28:
In file included from /Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_config.h:20:
In file included from **/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7** /vector:61:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algobase.h:66:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:89:10: error: no matching function for call to 'forward'
: first(std::forward<_U1>(__x)),
^~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_tree.h:1177:13: note: in instantiation of function template specialization 'std::pair<std::_Rb_tree_iterator<const char *>, bool>::pair<std::_Rb_tree_iterator<const char *>, bool>' requested here
return pair<iterator, bool>(_M_insert_(__x, __y, __v), true);
^
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_set.h:411:9: note: in instantiation of member function 'std::_Rb_tree<const char *, const char *, std::_Identity<const char *>, std::less<const char *>, std::allocator<const char *> >::_M_insert_unique' requested here
_M_t._M_insert_unique(__x);
^
/Scr/scr-test-steven/Programs/LLVM/llvm-3.6.1.src/utils/unittest/googletest/include/gtest/internal/gtest-internal.h:628:25: note: in instantiation of member function 'std::set<const char *, std::less<const char *>, std::allocator<const char *> >::insert' requested here
defined_test_names_.insert(test_name);
^
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/move.h:51:5: note: candidate function [with _Tp = std::_Rb_tree_iterator<const char *>] not viable: no known conversion from 'std::_Rb_tree_iterator<const char *>' to 'typename std::identity<_Rb_tree_iterator<const char *> >::type &&' (aka 'std::_Rb_tree_iterator<const char *> &&') for 1st argument
forward(typename std::identity<_Tp>::type&& __t)
^
In particular you may notice that:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7 was used. However, 'ninja check-all' really should have used the header files for gcc-4.8.4, not gcc-4.4.7 (system bundled gcc).
I have filed a bug report, but no one seems to want to answer it.
If anyone knows how to fix this, please let me know. Thanks.

OpenGL linker error on MinGW

I tryies to init OpenGL on windows without GLFW ... her some relevant code:
#include <windows.h>
//...
if(!(g_hDC = GetDC(hWnd)))
return false;
if(!(iPixelFormat = ChoosePixelFormat(g_hDC, &pfdPixelFormat)))
return false;
if(!SetPixelFormat(g_hDC, iPixelFormat, &pfdPixelFormat))
return false;
if(!(g_hRC = wglCreateContext(g_hDC)))
return false;
if(!wglMakeCurrent(g_hDC, g_hRC))
return false;
//...
when I compile with mingw32-g++ -Wall -O2 -Wl,--subsystem,windows -lopengl32 -mwindows Init.c I get following errors:
Temp\cclcIFFB.o:init.c:(.text+0x281): undefined reference to `_wglCreateContext#4'
Temp\cclcIFFB.o:init.c:(.text+0x2a0): undefined reference to `_wglMakeCurrent#8'
collect2.exe: error: ld returned 1 exit status
Why this linker error acours?
Try putting your Init.c before the -lopengl32:
mingw32-g++ -Wall -O2 Init.c -Wl,--subsystem,windows -lopengl32 -mwindows
gcc can be picky about argument positioning.
You must add the OpenGL linker definition library opengl32.lib to the list of to be linked libraries.

Resources