Thread: Why can't i compile?

  1. #1
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373

    Why can't i compile?

    I get this linker error when trying to compile the attached code:

    C:/MINGW/LIB//libmingw32.a(main.o)(.text+0x7f):main.c: undefined reference to `WinMain@16'

    Whats wrong with it?
    This war, like the next war, is a war to end war.

  2. #2
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    It's because you don't have a main function.

  3. #3
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    You need to have a WinMain function, if that isn't your current main cpp program, then change the file to a header file.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  4. #4
    Linux Forever
    Join Date
    Oct 2002
    Posts
    373
    I can't have two files or more. It won't link them at all. I have no idea how to use multible files, even inside a project.

    I get blank errors.
    This war, like the next war, is a war to end war.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM