|
From: Rajorshi G. <blo...@gm...> - 2011-11-28 15:38:43
|
Hi, I am facing a strange problem when trying to use MinGW on Windows XP SP3. In my project I am compiling various C and C++ files and finally linking them to create the final executable. The compilation goes smoothly but I have not been able to link the object files successfully. If I use g++ to link I always get the following error: c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lmsvcrt I don't know why g++ tries to link in libmsvcrt. I could not find this library in the MinGW directory even though I did find crtdll.dll. Why does this happen and is there a work around for it? If I try to call ld directly I get a whole bunch of unresolved symbols errors for "new", "delete", "memcpy", etc. I tried linking in all the libraries that should contain these symbols but that doesn't help. My command line in my Makefile is: $(CXX) -o ./a.out $(LIBGCC) $(OFILE_DIR)/* where LIBGCC = -L/mingw/lib/gcc/mingw32/4.6.1/ -L/mingw/lib/ -lcrtdll -lstdc++ -lgcc -lgcc_eh The errors are of the form: InputFiles.o:InputFiles.cpp:(.text+0x78): undefined reference to `operator delete(void*)' InputFiles.o:InputFiles.cpp:(.text+0xc8): undefined reference to `strcmp' InputFiles.o:InputFiles.cpp:(.text+0x12c): undefined reference to `operator delete(void*)' InputFiles.o:InputFiles.cpp:(.text+0x144): undefined reference to `std::__throw_bad_alloc()' InputFiles.o:InputFiles.cpp:(.text+0x14f): undefined reference to `operator new(unsigned int)' InputFiles.o:InputFiles.cpp:(.text+0x17f): undefined reference to `memmove' InputFiles.o:InputFiles.cpp:(.text+0x1d3): undefined reference to `strncmp' I have updated MinGW to the latest version using "mingw-get update <package-names>". I have installed almost all of of the packages. I have the latest Windows SDK installed. I could not find another thread which discusses this problem. Any help will be much appreciated. ~rajorshi |