Problem with MinGW

Problem with MinGW

1
NewbieNewbie
1

    Mar 06, 2007#1

    Hello, maybe I'm missing something completely obvious here but I'm trying to use UEStudio to create some small c++ programs, but I'm getting the following problem when trying to build and run the following code:

    Code: Select all

    #include <iostream>
    
    using namespace std;
    
    int main ()
    {
      cout << "Hello World!";
      return 0;
    }
    
    I am using the MinGW compiler, installed with their latest installer including all of the available packages. This is installed at c:\MinGW and the path is set as that in the compiler paths settings.

    The file is called test.cpp and is part of a project within UEStudio called test. I can compile this with no problems (i.e. create test.o) but when trying to build the application and create the exe file I get the following in my output box at the bottom:

    Code: Select all

    --------------------Configuration: test - Debug--------------------
    test.o:C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/locale_facets.tcc:2494: undefined reference to `std::string::size() const'
    test.o:C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/locale_facets.tcc:2503: undefined reference to `std::string::operator[](unsigned int) const'
    test.o:C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/locale_facets.tcc:2505: undefined reference to `std::string::operator[](unsigned int) const'
    test.o:C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/locale_facets.tcc:2508: undefined reference to `std::string::operator[](unsigned int) const'
    test.o: In function `main':C:\Documents and Settings\Mark\My Documents\Projects\test\Debug/../test.cpp:7: undefined reference to `std::cout'
    :C:\Documents and Settings\Mark\My Documents\Projects\test\Debug/../test.cpp:7: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    test.o: In function `_static_initialization_and_destruction_0':C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iostream:77: undefined reference to `std::ios_base::Init::Init()'
    :C:/MinGW/BIN/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/iostream:77: undefined reference to `std::ios_base::Init::~Init()'
    collect2: ld returned 1 exit status
    test.EXE - 0 error(s), 0 warning(s)
    
    obviously something wrong here... but I'm not sure if this is perhaps some kind of issue with an incorrect/missing path or what... but I can't figure it out :(

    help?

    4
    NewbieNewbie
    4

      Apr 18, 2007#2

      i am new to both ues and mingw, just want a visual c alternative. the error looks like a missing lib in link stage, but i can't find the linking config in ues.

        Apr 18, 2007#3

        found the solution
        build->set compiler options, change compiler from gcc to g++

        1
        NewbieNewbie
        1

          Jan 30, 2008#4

          Thank you!
          I have also met the same problem. :D

          2362
          MasterMaster
          2362

            Sep 01, 2012#5

            I did a full install of MinGW, using UEStudio 12.10, and once I change the compiler option to g++, it compiles, supposedly, with no errors, but the program runs, exits, and does nothing. I copied the program from the initial post just to be sure there are no errors.

            It simply isn't working with MinGW, or even CygWIN. I've tried both.

            The only compiler I can get it to work with is MS VC++ Express as far as C++ compilers go, but I was also needing to work with MinGW to compile projects written by others on Linux to port them to the Windows platform.

            Anyone else having issues, or learned how to get the current MinGW to work with the current UES?

              Sep 04, 2012#6

              Got this figured out. The MinGW configuration is from years ago, for a much older version. Paths have changed. I noticed many of the compilers that now come bundled with MinGW as part of the GNU Compiler Collection are now part of the main GCC, but were originally set up with separate paths, which are now deprecated.

              Looks like it is time for me to write new configuration files for the GNU Compiler Collection, as I get time.