XGCC stdarg.h NO SUCH FILE OR DIRECTORY - c++

I have included vsprintf in my project. However, when I compile it I receive the following error.
/opt/xgcc/decstation-ultrix/bin/xgcc -DIN_USER_MODE -c -I../userprog -I../threads -G 0 -Wall -O2 -DCHANGED -c vsprintf.c
vsprintf.c:12: stdarg.h: No such file or directory
make[1]: *** [vsprintf.o] Error 1
rm add.o
make[1]: Leaving directory `/home/banana/se31/code/test'
make: *** [all] Error 2
Line 12 of vsprintf contains the following:
#include <stdarg.h>
I verified that stdarg.h is properly installed in my system using the following short programs.
//test.c and test.cpp
#include <stdarg.h>
int main(void)
{
return 0;
}
When I run gcc test.c or gcc test.cpp I receive no errors which implies that my vsprint.c and gcc is properly installed.
I have gone through similar questions in stackoverflow but have not got a solution yet. I am using Ubuntu 32 bit as my Operating System. Could someone guide me on how I can resolve this issue?

As hvd
pointed out. I was checking for stdarg.h in the wrong place. To fix it, stdarg.h had to be added to my project. From there, the cross compiler (xgcc) was able to compile the program.

Related

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

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.

Compile c++ code with IDE, error at the second time

I'm a fresh c++ user in Windows 8 system. I have installed MinGW and setup the environment variables. I create the simplest hellow world code as below
#include<iostream>
#include<vector>
using namespace std;
int main(int argc, char **argv)
{
cout<<"hello world"<<endl;
return 0;
}
It works well at the first time, but when I do some small modification, for example delete "hello", and then build and run the project again. I found that the program will keep running without end. The command line keeps showing:
Current working directory: C:\Users\cr\Documents\project\helloworld\Debug
Running program: le_exec.exe ./helloworld
If I try to build it again, it shows
make.exe[1]: Entering directory 'C:/Users/cr/Documents/project/helloworld'
C:/Users/cr/MinGW/bin/g++.exe -c "C:/Users/cr/Documents/project/helloworld/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I. -I.
C:/Users/cr/MinGW/bin/g++.exe -o ./Debug/helloworld #"helloworld.txt" -L.
c:/users/cr/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot open output file ./Debug/helloworld.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
make.exe[1]: *** [Debug/helloworld] Error 1
helloworld.mk:78: recipe for target 'Debug/helloworld' failed
make.exe[1]: Leaving directory 'C:/Users/cr/Documents/project/helloworld'
make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====1 errors, 0 warnings====
I could not even delete the executable file "helloworld.exe" because it is using in 'System' until I restart the computer.
Update:
I can compile it in the command line:
C:/Users/cr/Documents/project/helloworld>g++ main.cpp -o test.exe
C:/Users/cr/Documents/project/helloworld>test.exe
It will then keep running until I close the command line window. If I open a new command line window and compile the file again. There is no problem.
Update2:
Problem also happens when I compile the cpp file the second time even if the file has not been edited.
C:/Users/cr/Documents/project/helloworld>g++ main.cpp -o test.exe
C:/Users/cr/Documents/project/helloworld>test.exe
hello world
C:/Users/cr/Documents/project/helloworld>g++ main.cpp -o test2.exe
C:/Users/cr/Documents/project/helloworld>test2.exe
It keeps running here.
Thanks all, I struggled with it for a whole day. The problem is anti-virus software...... I set it inactive and all things do well...
I don't want to point out what this software is, but just want to give out a reminder for this problem....

Trouble compiling praat on Windows with cygwin - internal compiler error

I'm attempting to compile Praat (http://www.fon.hum.uva.nl/praat/) with Cygwin. I tried following the instructions on the GitHub page (https://github.com/praat/praat). When I run 'make', several files compile with no problem, but then I get:
x86_64-w64-mingw32-gcc -std=gnu99 -municode -D_FILE_OFFSET_BITS=64 -O1 -I ../../sys -I ../../dwsys -c -o gsl_complex__math.o gsl_complex__math.c
gsl_complex__math.c: In function ‘gsl_complex_log10’:
gsl_complex__math.c:425:3: internal compiler error: Segmentation fault
return gsl_complex_mul_real (gsl_complex_log (a), 1 / log (10.));
^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
<builtin>: recipe for target 'gsl_complex__math.o' failed
make[1]: *** [gsl_complex__math.o] Error 1
make[1]: Leaving directory '/cygdrive/c/Users/Colin/workspace/praat-master/external/gsl'
makefile:14: recipe for target 'all' failed
make: *** [all] Error 2
I tried posting a question on the Praat user group with no luck. My suspicion is that it will work with a previous version of x86_64-w64-mingw32-gcc, but I'm not sure how to identify which version will work, or honestly, how to downgrade. (I'm also not sure what the difference is between x86_64-w64-mingw32-gcc and plain ol' gcc.) I'd like to avoid any solution that involves editing the source code because it has clearly been compiled as-is before with no problems.
Any suggestions or pointers is the right direction would be greatly appreciated! :)

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.

Can't build test application with WxWIdgets in Netbeans

I'm a total c++ Newbie.
I'm trying to build windows aplications with Wx-Widgets under Net Beans.
So far so good. I have instaled everything, configured, build wx-widgets and attached it to the new project - with help of a good man here: Can't make wx-widget work with net-beans.
Now I try to build my first app:
#include <wx/string.h>
int main(int argc, char **argv)
{
wxPuts(wxT("A wxWidgets console application"));
}
and this is what I get:
I'm not sure if this is readable so I paste the errors:
g++ `C:\WXWIN\wx-config --cxxflags` -c -g -I../../../WXWIN/include `C:\WXWIN\wx-config --cxxflags` -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
/bin/sh.exe: C:WXWINwx-config: command not found
/bin/sh.exe: C:WXWINwx-config: command not found
In file included from ../../../WXWIN/include/wx/defs.h:21:0,
from ../../../WXWIN/include/wx/string.h:25,
from main.cpp:1:
../../../WXWIN/include/wx/platform.h:196:22: fatal error: wx/setup.h: No such file or directory
compilation terminated.
make[2]: *** [build/Debug/MinGW-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/xampp/htdocs/WxWwigets_tutorial'
make[1]: Leaving directory `/c/xampp/htdocs/WxWwigets_tutorial'
BUILD FAILED (exit value 2, total time: 859ms)
Please notice that I have set everything in linker and compiler like ordered: http://wiki.wxwidgets.org/Compiling_using_Netbeans
The error is right in front of you: "command not found". If you use /bin/sh, you must use Unix style paths, e.g. C:/WXWIN/wx-config instead of DOS paths with the backslashes.
I seriously advise you to get familiar with the environment you're using instead of just following the Wiki instructions without understanding them, otherwise your problems won't be over any time soon.