gcc 5.4.0 cygwin 2.8.0 Win10
I've been been knocking my head around this problem.When I compile a simple program, see below, I get an error in one of the gcc include files. I checked the cygwin mailing list and no one has reported an error in the gcc download so I think it's a misunderstanding on my part but I can't figure what I did wrong. Prior to this point all the gcc include fileswere included automatically. Oh, and the compile is correct for other libraries.
The code is:
gcc -std=c++11 test.cpp or gcc test.cpp
include iostream
using namespace std;
int main(int argc, char** argv) { }
and the error message is:
/tmp/ccfBvaqg.o:test.cpp:(.text+0x44): undefined reference to
std::ios_base::Init::Init()' /tmp/ccfBvaqg.o:test.cpp:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
std::ios_base::Init::Init()'/tmp/ccfBvaqg.o:test.cpp:(.rdata$.refptr._ZNSt8ios_base4InitD1Ev[.refptr._ZNSt8ios_base4InitD1Ev]+0x0): undefined reference to `std::ios_base::Init::~Init()'
gcc -std
,include
has a hash (pound sign) in front of it and the filename is wrapped in<>
. In addition, this is a duplicate, which you would have learned if you'd searched here for undefined reference before posting. (And BTW, code isn't formatted with blockquotes; it's formatted as code. Select it and hit Ctrl+K on your keyboard or click the {} button on the toolbar.) – Ken White