Thread: error about not finding main, when its there.

  1. #1
    Registered User
    Join Date
    Oct 2001

    error about not finding main, when its there.

    ok, this program that i'm making worked just fine while using Dev-C++, and GCC, but when i moved it to MSVC++ 6.0 it says it cant find _main.

    Here is a more detailed error message:
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Client.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    any ideas on how to tell MSVC++ 6 where to find main?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Have you tested with a "hello world" program?

    Oh, and why are you using MSVC6? Use a newer compiler, unless you have no choice.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2001
    im using it cause Dev was getting a little to weak for what i need, and MSVC++ express 2005 didnt want to work for me... i tried multiple times... but i think i will have to try again

    EDIT: and i tried a simple Hello World app and it worked fine.
    Last edited by c++.prog.newbie; 05-28-2006 at 10:58 PM.

  4. #4
    Registered User
    Join Date
    Oct 2001
    ok, i reinstalled MSVC++ express 2005 and it doesnt complain about not finding main, but it cant read a .lib that i need it to. where as MSVC++ 6.0 and Dev-C++ can. I also know that it is opening the lib file cause if i remove the .lib file it complains that it cant open it.

    any ideas how to fix this?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well if your project contains more than one source file, did you compile all of them?

    Did you create a new project in a new directory, or simply create the vc++ project directly over the top of the dev-c++ project?

    Did you create a new vc++ project, or just re-use an existing vc++ project?

    Have you tried a "rebuild all"?
    When you did, did you see the status window compile ALL your source files?
    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.

  6. #6
    Registered User
    Join Date
    Oct 2001
    it contains multiple files,
    all of which get compiled,
    and yes its a new project in a new directory,
    its a new vc++ project not an old one,
    yes i have tried rebuild all, and it shows all of them being compiled.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  2. what to do with the main window
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 01-28-2003, 08:58 PM
  3. why is there a main?
    By Lynux-Penguin in forum C Programming
    Replies: 10
    Last Post: 06-02-2002, 12:06 AM
  4. void main
    By Shadow in forum A Brief History of
    Replies: 15
    Last Post: 05-29-2002, 07:08 PM
  5. void or int for main?:)
    By bigtamscot in forum C Programming
    Replies: 13
    Last Post: 09-27-2001, 03:11 AM