Cannot convert ‘bool’ to ‘gzFile {aka gzFile_s*}’ - c++

I am new to Linux environments, and trying to install a bioinformatics package (vcftools - https://vcftools.github.io/examples.html). For some reason I can compile without a problem in a Cygwin environment, other colleagues have installed the package without a glitch, but i get an error (per below) if I try to compile in an Ubuntu environment in a VirtualBox on the same computer. I get the following error. Does anyone have a suggestion on how to resolve this error?
$make install
output
Installing VCF tools
make[1]: Entering directory '/home/wde/selt/selectionTools/vcftools_0.1.11/cpp'
g++ -c -O2 -D_FILE_OFFSET_BITS=64 vcftools.cpp -o vcftools.o
g++ -MM -O2 -D_FILE_OFFSET_BITS=64 vcftools.cpp > vcftools.d
g++ -c -O2 -D_FILE_OFFSET_BITS=64 bcf_file.cpp -o bcf_file.o
g++ -MM -O2 -D_FILE_OFFSET_BITS=64 bcf_file.cpp > bcf_file.d
g++ -c -O2 -D_FILE_OFFSET_BITS=64 vcf_file.cpp -o vcf_file.o
vcf_file.cpp: In constructor ‘vcf_file::vcf_file()’:
**vcf_file.cpp:25:13: **error: cannot convert ‘bool’** to ‘gzFile {aka gzFile_s*}’ in assignment**
gzvcf_in = false;
^~~~~
Makefile:53: recipe for target 'vcf_file.o' failed
make[1]: *** [vcf_file.o] Error 1
make[1]: Leaving directory '/home/wde/selt/selectionTools/vcftools_0.1.11/cpp'
/bin/sh: 2: cd: can't cd to perl
Makefile:24: recipe for target 'install' failed
make: *** [install] Error 2
error with make

Basically what the makefile does is automating the calls to the compiler.
Thus, the output from the makefile is similar to usual compile errors you get, compiling a source file from within the command line.
The important line from the error log above is:
vcf_file.cpp: In constructor ‘vcf_file::vcf_file()’:
**vcf_file.cpp:25:13: **error: cannot convert ‘bool’** to ‘gzFile {aka gzFile_s*}’ in assignment**
gzvcf_in = false;
gzvcf_in is of type pointer to gzFile_s. Assigning a bool variable to a pointer type won't compile.
Thus, the error message. Replace, inside the vcf_file.cpp, false with the pointer literal std::nullptr or the macro NULL and re-run the makefile.
Btw. I checked the vcf_file.cpp file in the github repo from vcf. They do not contain the line leading to the above error. May you have an outdated / modified version, introducing the compiler error.

Related

error when building veins_inet: unexpected token

I have a Windows 10 PC where I installed Veins 5.0 following the tutorial and therefore I have installed OMNeT++ 5.6.1. I have also INET 4.2.0 that has been installed after opening the OMNeT IDE for the first time. I can open successfully the simulations from OMNeT++, Veins and INET. Nevertheless, when it comes to build the veins_project of veins/subprojects I get the following error:
10:48:52 **** Incremental Build of configuration gcc-release for project veins_inet ****
make MODE=release all
make[1]: Entering directory '/c/src/veins-veins-5.0/subprojects/veins_inet/src'
veins_inet/VeinsInetApplicationBase.cc
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `clang++ -c -std=c++11 -O3 -DNDEBUG=1 -MMD -MP -MF ../out/clang-release/src/veins_inet/VeinsInetApplicationBase.o.d -isystem /usr/include -isystem /mingw64/include -Wno-deprecated-register -Wno-unused-function -fno-omit-frame-pointer -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -DVEINS_INET_EXPORT -DINET_IMPORT -DVEINS_IMPORT -DVEINS_INET_EXPORT -I"C:/src/veins-veins-5.0/subprojects/veins_inet/src" -I"C:/src/veins-veins-5.0/src" -I"C:/src/inet4/src" -I. -IC:/Universidad/2019-2020 (Master)/1B - Quadrimestre Primavera/TFM/OMNET/inet/src -IC:/src/veins-veins-5.0/src -I. -IC:/src/omnetpp-5.6.1/include -o ../out/clang-release/src/veins_inet/VeinsInetApplicationBase.o veins_inet/VeinsInetApplicationBase.cc'
make[1]: *** [Makefile:153: ../out/clang-release/src/veins_inet/VeinsInetApplicationBase.o] Error 1
make[1]: Leaving directory '/c/src/veins-veins-5.0/subprojects/veins_inet/src'
make: *** [Makefile:36: all] Error 2
"make MODE=release all" terminated with exit code 2. Build might be incomplete.
10:48:53 Build Failed. 2 errors, 0 warnings. (took 942ms)
Does anyone experience something similar?
It's clear the problem is in your command line
clang++ -c -std=c++11 ... -IC:/Universidad/2019-2020 (Master)/1B ...
Don't put parentheses or spaces in folder names. It's only likely to lead to confusion.

make: g++: error: CreateProcess: No such file or directory

I see that this issue has been posted many many times but none of solutions worked for me and my problem is a bit different.
The problem:
When a use a makefile and mingw32-make, I get the error:
g++: error: CreateProcess: No such file or directory
However, if I copy/paste the SAME command that the makefile tried to do and paste it in the SAME command prompt it works. This problem only occurs when I try to build with a makefile.
Here's more info:
g++ ./src/main.cpp ./src/application.cpp -I C:\Code\infographie\Labs\inc -L C:\Code\infographie\Labs\lib -I C:\Code\infographie\Labs\inc -g -Dmain=SDL_main -L C:\Code\infographie\Labs\lib -lmingw32 -lSDL2main -lSDL2 -o bin/debug/labs.exe
g++: error: CreateProcess: No such file or directory
makefile:23: recipe for target 'all' failed
mingw32-make: *** [all] Error 1
As I said, If I copy/paste the first line it will work.
What can I try?
UPDATE: I've installed cygwin, adjusted SDL libs and recompiled. Now I get this error when I try to use make. If I copy/paste the command, it works.
g++ ./src/main.cpp ./src/application.cpp -I C:\Code\infographie\Labs\inc -L C:\Code\infographie\Labs\lib -I C:\Code\infographie\Labs\inc -g -Dmain=SDL_main -L C:\Code\infographie\Labs\lib -lcygwin -lSDL2main -lSDL2 - mwindows -o bin/debug/labs.exe
make: g++: Command not found
make: *** [makefile:23: all] Error 127
FIXED IT, don't declare a variable named PATH...
Stop using MinGW.
MinGW has not been updated since 2013. It has been replaced by Cygwin and
MSYS2. The MinGW project doesn’t even offer a 64-bit compiler.
Cygwin can be installed in about 3 minutes, I would give it a try.

Error building wxWidgets using -j (jobs) option with MinGW

I'm compiling WxWidgets for Windows using the following command line:
mingw32-make -f makefile.gcc BUILD=release SHARED=1 -j6
The last parameter (-j) is used to speed up the compilation by running multiple jobs in parallel, in my case making full use of my 6-core processor. A single-threaded build normally takes very long.
However, I get the following output when hitting Enter:
if not exist gcc_mswudll mkdir gcc_mswudll
if not exist ..\..\lib\gcc_dll mkdir ..\..\lib\gcc_dll
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\msw
u -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/
regcomp.c
The system can not find the path specified.
0 file(s) copied.
makefile.gcc:5651: recipe for target '..\..\lib\gcc_dll\mswu\wx\setup.h' failed
mingw32-make: *** [..\..\lib\gcc_dll\mswu\wx\setup.h] Error 1
mingw32-make: *** Waiting for unfinished jobs....
In file included from ..\..\include/wx/defs.h:27:0,
from ../../src/regex/regcustom.h:39,
from ../../src/regex/regguts.h:38,
from ../../src/regex/regcomp.c:33:
..\..\include/wx/platform.h:183:22: fatal error: wx/setup.h: No such file or directory
#include "wx/setup.h"
^
compilation terminated.
makefile.gcc:5702: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
mingw32-make: *** [gcc_mswudll\wxregex_regcomp.o] Error 1
Then, if I just repeat the same command a second time, the following output is shown:
if not exist ..\..\lib\gcc_dll\mswu mkdir ..\..\lib\gcc_dll\mswu
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\msw
u -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/
regcompThe system can not find the path specified.
.c
0 file(s) copied.
makefile.gcc:5651: recipe for target '..\..\lib\gcc_dll\mswu\wx\setup.h' failed
mingw32-make: *** [..\..\lib\gcc_dll\mswu\wx\setup.h] Error 1
mingw32-make: *** Waiting for unfinished jobs....
In file included from ..\..\include/wx/defs.h:27:0,
from ../../src/regex/regcustom.h:39,
from ../../src/regex/regguts.h:38,
from ../../src/regex/regcomp.c:33:
..\..\include/wx/platform.h:183:22: fatal error: wx/setup.h: No such file or directory
#include "wx/setup.h"
^
compilation terminated.
makefile.gcc:5702: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
mingw32-make: *** [gcc_mswudll\wxregex_regcomp.o] Error 1
Then... If I try a third time, the compilation finishes successfully.
Question: Is it ok to follow this procedure to build WxWidgets in parallel, or is there a possibility that it will lead to problems when using the compiled binaries later on?
Unfortunately there is indeed a bug in MSW makefiles with missing dependencies of the various libraries on setup_h target. It should be safe to do make setup_h first and then make -jN.
Alternatively, you could build using configure as explained in this old but still valid post, then just make -jN works perfectly fine.

Building gold linker with MinGW on Windows, FLEX/bison 'YYSTYPE' was not declared in this scope

I'm trying to build the gold linker included with GNU binutils using mingw. The steps I have taken-
Install mingw with all packages using the installer.
Install the windows version of FLEX to the default location using the windows installer.
Run ./configure in the gold linker directory from the mingw shell which seems to work fine
Run make, this is where I'm getting some errors.
I've included the complete output of ./configure and make in a pastebin here:
http://pastebin.com/1XLkZVVm
But the important part is this:
make[2]: Entering directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
g++ -DHAVE_CONFIG_H -I. -I. -I./../include -I./../elfcpp -DLOCALEDIR="\"/usr/lo
cal/share/locale\"" -DBINDIR="\"/usr/local/bin\"" -DTOOLBINDIR="\"/usr/local//bi
n\"" -DTOOLLIBDIR="\"/usr/local//lib\"" -W -Wall -Wno-format -Werror -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=expression.o -MT expression.
o -MD -MP -MF .deps/expression.Tpo -c -o expression.o expression.cc
In file included from expression.cc:33:0:
script-c.h:221:7: エラー: 'yylex' initialized and declared 'extern' [-Werror]
script-c.h:221:7: エラー: 'YYSTYPE' was not declared in this scope
script-c.h:221:15: エラー: expected primary-expression before ',' token
script-c.h:221:17: エラー: expected primary-expression before 'void'
script-c.h:221:30: エラー: expression list treated as compound expression in ini
tializer [-fpermissive]
cc1plus.exe: all warnings being treated as errors
make[2]: *** [expression.o] Error 1
make[2]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make: *** [all] Error 2
I've looked in the script-c.h file and it has this function:
/* Called by the bison parser skeleton to return the next token. */
extern int
yylex(YYSTYPE*, void* closure);
However YYSTYPE is not defined anywhere that I can find.
I'm new to using mingw and msys so I may have missed some steps somewhere. Any help getting this to build would be really appreciated.
As this question had lain unanswered for some months, I looked into the problem.
I downloaded binutils-2.25 (latest at this date) and tried to follow your actions.
I discovered that if you only build gold without the rest of binutils it does not build. If you perform a ./configure and make at the top level it builds the gold fine. If you then cd gold and do the ./configure and make (albeit unnecessarily) then it works fine also.
I did find that when it failed on gold alone it got further than your build did.
My attention was also drawn to your phrase FLEX to the default location. The instructions with FLEX make it clear that you should not rely on the default location (which may be /Program Files/ or similar) but must use path that does not contain any spaces. If you had not noticed this, then that is your fault.
As the latest builds, you can get gold working by ensuring you have installed flex (and bison) properly in non-space paths, then downloading 2.25 and building the whole of binutils rather than gold alone.
I hope this analysis is useful for someone who comes later and finds similar issues.

make: *** [src/Class.o] Error 1 eclipse

ok so i installed CDT for C++ development on my machine. I tried to make it work and followed these instructions to set everything up. By mistake i have gone into the Project>Properties>C++ Build>Enviorement and hit restore defaults by mistake. I dont know if that changed anything but i get the following error when i run my class.
I tried to switch the slashes in the given path "C:\Users\Nathan\workspace\Project\Debug" to forward slashes but that did nothing. I still get the same error. Any hints on what im doing wrong?
19:12:58 **** Incremental Build of configuration Debug for project Project ****
make all
Building file: ../src/Project.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Project.d" -MT"src/Project.d" -o "src/Project.o" "../src/Project.cpp"
cygwin warning:
MS-DOS style path detected: C:\Users\Nathan\workspace\Project\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Nathan/workspace/Project/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/cwchar:44:0,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/postypes.h:42,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/iosfwd:42,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ios:39,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/ostream:40,
from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/iostream:40,
from ../src/Project.cpp:9:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/cstddef:44:20: fatal error: stddef.h: No such file or directory
src/subdir.mk:18: recipe for target `src/Project.o' failed
compilation terminated.
make: *** [src/Project.o] Error 1
19:12:59 Build Finished (took 535ms)