Explanation of a Compilation Error Needed

This is a discussion on Explanation of a Compilation Error Needed within the C Programming forums, part of the General Programming Boards category; Hello, I'm currently working on implementing a Vector in C. When I compile my Vector.c file, I get the following ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    69

    Explanation of a Compilation Error Needed

    Hello,

    I'm currently working on implementing a Vector in C. When I compile my Vector.c file, I get the following message:

    [Linker Error] undefined reference to 'WinMain@16'

    What does this mean exactly? My file is just a bunch of functions based off of a Vector.h header file. There is no main in it. Does that have something to do with it? I'm sure this is answered somewhere on this site, but I couldn't find anything.

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    if you're trying to compile your file as a header you have to use the .h extension. If you compile as a .c extension, it's going to look for a main() function. I'm not quite sure what you're asking about, I hope I helped.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,336
    > [Linker Error] undefined reference to 'WinMain@16'
    It means you're compiling your console app (which begins with main) as a windows app (which begins at winmain)

    Go change your project to compile as a console app

    Yes, this has been discussed many times before
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked Lists
    By Bleu_Cheese in forum C++ Programming
    Replies: 13
    Last Post: 12-21-2007, 08:17 PM
  2. "Different levels of indirection" compilation error
    By emanresu in forum C Programming
    Replies: 2
    Last Post: 11-22-2006, 04:01 AM
  3. Compilation units
    By filler_bunny in forum C++ Programming
    Replies: 0
    Last Post: 10-21-2003, 03:57 AM
  4. MS VC++ Crash on compilation
    By Magos in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 08-23-2003, 07:06 PM
  5. malloc problem in SUN in 64-bit compilation
    By ylzhang in forum C Programming
    Replies: 6
    Last Post: 05-31-2003, 11:48 AM

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