Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unknown type name 'uint32_t', MinGW

Tags:

c

windows

mingw

I get the error unknown type name 'uint32_t' and included stdint.h. uint8_t doesn't produce an error, neither does uint16_t.

I'm using MinGW and the following make-lines:

# Build for Windows under MinGW
#MINGWDBG= -DDEBUG -O0
MINGWDBG= -DNDEBUG -Os
#MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,console $(MINGWDBG) -DHAVE_STDINT
MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)
mingw:
    windres win32\res.rc win32\res.o
    gcc $(MINGWOPT) mongoose.c -lws2_32 \
        -shared -Wl,--out-implib=$(PROG).lib -o $(PROG).dll
    gcc $(MINGWOPT) mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \
        -o $(PROG).exe

Code:

uint32_t function(void) {
    return VALUE;
}

And the includes:

#include <stdio.h>
#include <string.h>
#include "mongoose.h"
#include "main.h"
#include <stdint.h>
like image 961
RobotRock Avatar asked Feb 22 '23 18:02

RobotRock


2 Answers

To answer my own question, changing the order of the includes seemed to do the trick.

like image 65
RobotRock Avatar answered Feb 24 '23 07:02

RobotRock


If

#include "main.h"
#include <stdint.h>

didn't work, but

#include <stdint.h>
#include "main.h"

did, it is likely that your main.h file relies on stdint.h. That means you should add #include <stdint.h> to main.h.

like image 23
Neuron Avatar answered Feb 24 '23 06:02

Neuron