MinGW Installation

This is a discussion on MinGW Installation within the Tech Board forums, part of the Community Boards category; Im trying to install the MinGW compiler on my Windows XP Laptop, but i'm having a few difficulties. I had ...

  1. #1
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    934

    MinGW Installation

    Im trying to install the MinGW compiler on my Windows XP Laptop, but i'm having a few difficulties.

    I had no problems with the installation itself, and the PATH settings went smooth, but i've hit a brick wall now.

    I'm trying to compile a Hello World app:

    Code:
    #include <iostream>
    
    int main()
    {
    	std::cout << "Hello World!";
    	std::cin.ignore();
    }
    But im getting a long list of errors:

    Code:
    hello.cpp:7:2: warning: no newline at end of file
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0xd): undefined refere
    nce to `std::string::size() const'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x60): undefined refer
    ence to `std::string::operator[](unsigned int) const'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x9f): undefined refer
    ence to `std::string::operator[](unsigned int) const'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0xce): undefined refer
    ence to `std::string::operator[](unsigned int) const'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x135): undefined refe
    rence to `std::cout'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x13a): undefined refe
    rence to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <st
    d::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char
    const*)'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x152): undefined refe
    rence to `std::cin'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x157): undefined refe
    rence to `std::istream::ignore(int, int)'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x17f): undefined refe
    rence to `std::ios_base::Init::Init()'
    C:\DOCUME~1\Tue\LOKALE~1\Temp/ccisbaaa.o:hello.cpp:(.text+0x19a): undefined refe
    rence to `std::ios_base::Init::~Init()'
    collect2: ld returned 1 exit status
    Looks a bit like linking errors, but i'm not sure, how do i fix this?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,980
    You included C++ in the installation, and ran something like this:
    g++ -o hello.exe hello.cpp
    right?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    934
    Quote Originally Posted by laserlight View Post
    You included C++ in the installation, and ran something like this:
    g++ -o hello.exe hello.cpp
    right?
    Ehh, no, that's not quite what i did. I did include C++, but i just did "gcc hello.cpp". Anyways, it's working beatifully now. What is that "-o" parameter for? Just the output name of the program?

    Is there a way to make MinGW compile the program and then run it for me, so i don't have to do it manually?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,980
    What is that "-o" parameter for? Just the output name of the program?
    Yes, you can do a g++ --help for more options.

    Is there a way to make MinGW compile the program and then run it for me, so i don't have to do it manually?
    I do not think so, though it should be possible to write say, a batch file (or a program, heheh) that could automate this. Personally, I do not see running the program yourself as being particularly difficult
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    934
    Quote Originally Posted by laserlight View Post
    I do not think so, though it should be possible to write say, a batch file (or a program, heheh) that could automate this.
    Yea, i was thinking of just doing a batch-file for it aswell, i'll get around to that later.

    Quote Originally Posted by laserlight View Post
    Personally, I do not see running the program yourself as being particularly difficult
    I've been using Dev-Cpp for the last couple of months, and it has that F9 shortcut for compiling and running your program, so after changing, having to do it all manually just seems like a daunting task

    Anyways, thanks for the help Laserlight!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cygwin & MinGW
    By TmX in forum Tech Board
    Replies: 3
    Last Post: 09-26-2006, 08:44 AM
  2. STLport with MingW - Long Long error on project build
    By Mario F. in forum C++ Programming
    Replies: 2
    Last Post: 08-21-2006, 08:55 AM
  3. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  4. MinGW Installation checklist (win32)
    By Mario F. in forum Tech Board
    Replies: 5
    Last Post: 06-24-2006, 05:53 PM
  5. SDL and MinGW Studio
    By Vicious in forum Tech Board
    Replies: 0
    Last Post: 07-30-2004, 09:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21