I have a minimal MinGW (nuwen) set up from isocpp.org 'Get started' which is gcc version 6.1.0 compiled for windows
this is my code
#include <stdio.h>
#include <string>
int main (int argc, char* argv[]) {
printf ("hello world\n");
std::string mystring {"my string"};
}
I keep getting the following error (among others)
C:\util\MinGW\proj>gcc main.cpp
C:\Users\gmyer\AppData\Local\Temp\ccXSjGdh.o:main.cpp:(.text+0x2e): undefined reference to `std::allocator::allocator()' collect2.exe: error: ld returned 1 exit status
What I have done
- checked that string file exists in include directory CPLUS_INCLUDE_PATH=C:\util\MinGW\include;C:\util\MinGW\include\freetype2 C_INCLUDE_PATH=C:\util\MinGW\include;C:\util\MinGW\include\freetype2
- checked that allocator exists in the 'string' file
Do I need to add another include file to make it work?