undefined reference to `_WinMain@16'

This is a discussion on undefined reference to `_WinMain@16' within the C++ Programming forums, part of the General Programming Boards category; Hello, I am trying to run the following program in Codeblocks: Code: #include <iostream> using namespace std; void Reverseds (double ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    2

    undefined reference to `_WinMain@16'

    Hello,

    I am trying to run the following program in Codeblocks:

    Code:
    #include <iostream>
    
    using namespace std;
    
    void Reverseds (double nums[], const int size)
     {
        int i;
        double nums2[size];
    
        for (i=0; i<size; i++)
        {
            nums2[i] = nums[size - i];
            cout << nums[size - i] << "   " << nums2[i] << "\n";
        }
     }
    
    int Main ()
    {
    int size = 5;
    double nums[] = { 1.77, 5.6, 7.8, 10.11, 12.3};
    
    Reverseds (nums,size);
    
    return 0;
    }
    I am getting this error when trying to build it

    C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):main.c.text+0x104): undefined reference to `_WinMain@16'
    collect2: ld returned 1 exit status
    Process terminated with status 1 (0 minutes, 1 seconds)
    1 errors, 0 warnings

    I have looked up undefined reference to `_WinMain@16' on the internet and the two problems that it is usually associated with are:
    1 - No Main () in the program. I have int Main () in my program
    2 - The application type selected is the wrong type (not a console application). However, my application type is a console application.

    Can someone tell me why this will not build?

  2. #2

    Join Date
    Apr 2008
    Location
    USA
    Posts
    76
    You have to use a lowercase 'm' in 'main':
    Code:
    int main()
    {
    ...

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    2
    Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 05:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM

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