C: warning/error: passing argument from incompatible pointer type [-Wincompatible-pointer-types]
A pointer of one type is passed where another pointer type is expected.
Exact message you may see
incompatible pointer typepassing argument from incompatible pointer type
Seen on:
C GCC
Meaning
GCC 14 turned this warning into an error by default, breaking older C code that compiled before.
Common causes
- Wrong pointer type (int* vs long*)
- const mismatch
- Callback signature differs
- Upgrading to GCC 14
⚡ Quick fix
- Cast deliberately or fix the type
- Fix function signature
- Use
-Wno-error=incompatible-pointer-typesas a stopgap
Detailed fix by platform
GCC 14
CFLAGS+=-Wno-error=incompatible-pointer-typesfor legacy code
How to diagnose
- Types — Which two?
- GCC — Version 14?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- address of local variable returned C/C++: warning: address of local variable 'x' returned [-Wreturn-local-addr]
- discards qualifiers C++: error: passing 'const X' as 'this' argument discards qualifiers [-fpermissive]
- invalid memory address or nil pointer dereference Go: panic: runtime error: invalid memory address or nil pointer dereference
Most viewed in C/C++
- Bus error C/C++: Bus error (core dumped) — SIGBUS from misaligned access or a bad memory-mapped file
- AddressSanitizer: heap-use-after-free C/C++: ==ERROR: AddressSanitizer: heap-use-after-free on address — memory used after delete/free
- AddressSanitizer: heap-buffer-overflow C/C++: ==ERROR: AddressSanitizer: heap-buffer-overflow on address — READ/WRITE of size N
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 28 Nov 2026