How to fix an error during compiling:_mingw.h

This is a discussion on How to fix an error during compiling:_mingw.h within the C Programming forums, part of the General Programming Boards category; Dear all, I just have written my very first C code, and, as everybody else, got an error during compiling. ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    20

    How to fix an error during compiling:_mingw.h

    Dear all,

    I just have written my very first C code, and, as everybody else, got an error during compiling.

    on terminal (linux, ubuntu):

    gcc hwe.c -lm hwe
    gcc: hwe: No such file or directory
    In file included from hwe.c:2:
    /usr/include/math.h:31:20: error: _mingw.h: No such file or directory


    I believe that is something related to the math.h library. How do I fix that?

    I will be really grateful for any tips.

    Tiago

    The code is a very simple statistical test used in genetics:

    Code:
    #include <stdio.h>
    #include <math.h>
    
    int x, n;
    float f_A;
    float chi2 = 0;
    int genotype[4];
    int expected[4];
    
    
    int main(void)
    {
    	for (x = 1; x <= 3 ; x++)
    	
    	{
    		printf("Enter a count:");
    		scanf("%d" , &genotype[x]);
    				
    	}
    	
    	
    	n = genotype[1]+genotype[2]+genotype[3];
    	f_A = ((2*genotype[1])+(genotype[2]))/(n*2);
    	expected[1] = pow(f_A,2)*n;
    	expected[2] = 2*(f_A)*(1-f_A)*n;
    	expected[3] = pow(1-f_A,2)*n;
    	
    	for (x = 1; x <= 3; x++)
    	{	
    	chi2 = chi2 + (pow((genotype[x]-expected[x]),2)/(expected[x]));
    	}
    	
    	
    
    	printf("The chi2 value is: %f", chi2);
    	
    	return 0;
    }
    Last edited by TiagoPereira; 08-10-2010 at 01:19 AM. Reason: minor correction to fix a formula

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    20
    Thanks, but the same error still remains I speak R and Stata. So, I am very used to lists. Before posting a question, it stands to logic that I google around the problem.

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    20
    tiago@tiago-laptop:~/Desktop$ head hwe.c
    #include <stdio.h>
    #include <math.h>

    int x, n;
    float f_A;
    float chi2 = 0;
    int genotype[4];
    int expected[4];


    tiago@tiago-laptop:~/Desktop$ gcc -Wall hwe.c -lm hwe
    gcc: hwe: No such file or directory
    In file included from hwe.c:2:
    /usr/include/math.h:31:20: error: _mingw.h: No such file or directory
    tiago@tiago-laptop:~/Desktop$ ^C
    tiago@tiago-laptop:~/Desktop$ gcc -Wall hwe.c -o hwe
    In file included from hwe.c:2:
    /usr/include/math.h:31:20: error: _mingw.h: No such file or directory
    tiago@tiago-laptop:~/Desktop$

  5. #5
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Try:
    gcc hwe.c -lm -o hwe
    Should fix:
    gcc: hwe: No such file or directory

    idk about the rest.

  6. #6
    Registered User jdragyn's Avatar
    Join Date
    Sep 2009
    Posts
    93
    In file included from hwe.c:2:
    /usr/include/math.h:31:20: error: _mingw.h: No such file or directory
    This is telling you that the _mingw.h file, which is #included in math.h (which YOU #include in your hwe.c source file) does not exist. This suggests a problem with your MinGW installation. My personal first step would be to re-install MinGW. If that doesn't fix it, someone here might be able to help, but the Ubuntu forums will also probably help, too.

    gcc: hwe: No such file or directory
    is complaining about "hwe" on the command line. That token is being interpreted by gcc as an input file, but it can't find the file. Anything not preceded by a - on the gcc command line is assumed to be an input file. User Name:'s advice tells gcc (through the -o) that hwe is the name of the output file.
    C+/- programmer extraordinaire

  7. #7
    Registered User
    Join Date
    Aug 2010
    Posts
    20
    Many, many thanks! Your tips were really helpful, guys!

    I have installed all libraries (MingGW), updated the built-essential, etc.. etc... without success, however. Then, I solved the problem using a very dirty strategy:

    I have copied the contents of the /usr/include/ from a PC where that compiling error doesn't show up to my laptop. Then, typing

    gcc hwe.c -lm -o hwe

    worked like a charm!

    Thanks again!

    Tiago

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FIX Protocol: FIX using QuickFix
    By arupsarkar in forum C++ Programming
    Replies: 0
    Last Post: 07-16-2010, 12:08 PM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  3. compiling my code, i can't fix error
    By howru in forum C Programming
    Replies: 2
    Last Post: 04-22-2008, 04:38 AM
  4. C++ code need help to fix
    By McReal in forum C++ Programming
    Replies: 9
    Last Post: 05-12-2007, 03:48 PM
  5. Help me fix my mess!!!!
    By Starr in forum C++ Programming
    Replies: 35
    Last Post: 02-01-2006, 03:40 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21