makes pointer from integer without a cast C/C++ Origin: Application & API OSI layer 7 · Application Last updated 28 Nov 2026

C: warning: assignment makes pointer from integer without a cast

An integer is assigned to a pointer (or the reverse) without conversion — often because a function was implicitly declared.

Exact message you may see makes pointer from integer without a castmakes integer from pointer without a cast
Seen on: C GCC Clang

Meaning

On 64-bit systems an implicit int return truncates pointers, causing crashes. This often accompanies implicit declaration of function.

Common causes

  • Missing header so function assumed to return int (malloc without <stdlib.h>)
  • Assigning an int to a pointer

⚡ Quick fix

  1. Include the right header
  2. Cast intentionally with (intptr_t)

Detailed fix by platform

GCC

  1. Treat as error: -Werror=int-conversion -Werror=implicit-function-declaration

How to diagnose

  1. Header — Included?
  2. Types — Pointer vs int?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

address of local variable returned — C/C++: warning: address of local variable 'x' returned [-Wreturn-local-addr] (C/C++)address of local vari…implicit declaration of function — C: warning: implicit declaration of function 'foo' [-Wimplicit-function-declaration] (C/C++)implicit declaration …incompatible pointer type — C: warning/error: passing argument from incompatible pointer type [-Wincompatible-pointer-types] (C/C++)incompatible pointer …invalid memory address or nil pointer dereference — Go: panic: runtime error: invalid memory address or nil pointer dereference (Go)invalid memory addres…ISO C++ forbids comparison between pointer and integer — C++: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] (C/C++)ISO C++ forbids compa…ISO C++ forbids converting a string constant — C++: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] (C/C++)ISO C++ forbids conve…may be used uninitialized — C/C++: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized] (C/C++)may be used uninitial…will be initialized after — C++: warning: 'X::a' will be initialized after 'X::b' [-Wreorder] (C/C++)will be initialized a…makes poi…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.