In C++, you need to cast the return of malloc()
char *foo = (char*)malloc(1);
More Related Contents:
- How to compile a program with limit time (5s), using MinGW-Gnu C++
- Undefined reference to static class member
- Compiling C++11 with g++
- Error: free(): invalid next size (fast):
- How does #include work in C++? [duplicate]
- Why does C++ require a cast for malloc() but C doesn’t?
- Compiling a C++ program with GCC
- Different floating point result with optimization enabled – compiler bug?
- How to create a static library with g++?
- 😃 (and other Unicode characters) in identifiers not allowed by g++
- How can I get the size of a memory block allocated using malloc()? [duplicate]
- GCC equivalent of MS’s /bigobj
- Linking g++ 4.8 to libstdc++
- What’s the point of g++ -Wreorder?
- Linking to MSVC DLL from MinGW
- Multithreaded Memory Allocators for C/C++
- extra qualification error in C++
- Are C++17 Parallel Algorithms implemented already?
- GCC: Difference between -O3 and -Os
- Memory allocation and deallocation across dll boundaries
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- Link error “undefined reference to `__gxx_personality_v0′” and g++ [duplicate]
- Compile c++14-code with g++
- Linking files in g++
- What is a .h.gch file?
- Do I really have to worry about alignment when using placement new operator?
- Why can’t I use with g++ 4.9.2?
- Why does stack not compile in g++? [duplicate]
- Eclipse C++ : “Program “g++” not found in PATH”
- get part of std::tuple