Compile C for Windows with MinGW - c

I installed the latest version of MinGW and trying to compile the project:
\MinGW\bin\gcc.exe -O3 -flto -Wall -msse src/*.c -o noname -lm -lpthread
But nothing happens. No errors, no exe files, nothing.
I am not familiar with Windows in terms of compilation.
This is a simple console application that is compilable on Ubuntu without problems with the same command.
What I am doing wrong?

Related

.dSYM folder for debugging

I just set-up GNU gcc on my Mac through some re-organization of my path and builds so it's not an alias for clang anymore. Running gcc -g, I expect debugging symbols to be self-contained within the executable, but they are still generating the .dSYM. How can I get the behavior I expect instead of the .dSYM folder, which I believe comes from Xcode command line tools?
I am specifically running:
gcc -O3 -g3 -Wall -Wextra -fanalyzer -march=native -mtune=native -mrdrnd
but this behavior even occurs with basic gcc -g hello.c -o hello_world program.

Exceuting a C program that uses LAPACK and BLAS

I have a C program "main.c" that uses LAPACK and BLAS subroutines. It is working fine on Ubuntu, showing the right results on the terminal.
Since I am a Windows user, I use Cygwin environment. However, when I execute my program after compiling with gcc main.c -llapack -lblas -lgfortran or even gcc -std=c99 main.c -llapack -lblas -lgfortran, nothing is showing on the terminal, although there are no compilation errors.
Does anyone have an idea what would be the problem?
Thank you.

Settings GCC (ARM-Linux) in Eclipse Mars for 'C project

I am experimenting with cross compiling for ARM-Linux under Windows using Eclipse-Mars. My set-up is as follows:
Win10 x64
Eclipse Mars.2 Release (4.5.2)
GNU Toolchain for RaspberryPi (SysGCC)
Target platform: RaspberryPi2 running Raspian
Source project in 'C (not C++) using Linux Threads (pthreads)
I have knocked up a small 'C project using 'pthreads' which compiles under Eclipse and runs successfully on the Pi.
My problem is that Eclipse shows a number of errors in its Problems TAB to do with Linux's threads:
Type 'pthread_cond_t' could not be resolved
Type 'pthread_mutex_t' could not be resolved
Type 'pthread_t' could not be resolved
I have Eclipse as:
Cross GCC Compiler settings to use g++ with -std=c++11 -O0 -g3 -Wall -c -fmessage-length=0.
Cross G++ Compiler settings to use g++ with -std=c++11 -O0 -g3 -Wall -c -fmessage-length=0.
In other words both are the same.
If I rename my source files from foo.c to foo.cpp and recompile, then the Eclipse errors disappear!!!
This implies that Eclipse's C++ settings are correct, but its 'C settings are not.
Can anybody suggest anything for me to try?
g++ ist a C++ compiler, so you might try to use other settings for the Cross GCC Compiler, eg. gcc.
Also make sure you are linking the pthread library.

gcc can't find phtread in cygwin

I'm trying to install samtools () on cygwin.
I followed the various tricks here and here but looks like my problem is that i can't have a functioning pthread.
gcc is installed and works, zlib is installed and works and ncurses is installed and works + everything was added to the $PATH...but when i run make and it gets to the following line in Makefile:
gcc -pthread $(LDFLAGS) -o $# $(AOBJS) libbam.a $(HTSLIB) $(LDLIBS) $(LIBCURSES) -lm -lz
then it throws an error because it doesn't recognize the unix command -pthread. now...pthread should be a part of the default installation in cygwin so I don't understand why this is not working...
any hint would be great!
gcc's option -pthread is not available on Cygwin.

How to compile some C code on 64-bit Windows 7 machine using gcc 4.5.3

I am trying to compile a plugin for Stata (a statistical programming language) that is written in C. Its author was able to compile it on other machines using the following commands on a 32-bit PC Windows (using Cygwin):
gcc -shared -mno-cygwin stplugin.c strgroup.c -O3 -funroll-loops -o strgroup.PC.Windows.plugin
He was also able to compile it on 64-bit Unix with:
gcc -shared -fPIC -DSYSTEM=OPUNIX stplugin.c strgroup.c -O3 -funroll-loops -o "strgroup.PC (64-bit x86-64).Unix.plugin"
And Macintosh OS X with:
gcc -bundle -arch i386 -arch x86_64 -arch ppc -DSYSTEM=APPLEMAC stplugin.c strgroup.c -O3 -funroll-loops -o "strgroup.Macintosh.MacOSX.plugin"
I am trying to compile it on 64-bit Windows 7 machine using Cygwin 1.7.9-1 and gcc v4.5.3. The mno-cygwin flag is giving me trouble, but I am not able to figure out how to use a mingw-targeted cross-compiler.
The -mno-cygwin option is no longer supported.
Install either of the mingw-*, mingw64-i686-* or mingw64-x86_64-* toolchain (category Devel in the Cygwin package manager) to get a proper cross-compiler.

Resources