error about not finding main, when its there.

This is a discussion on error about not finding main, when its there. within the C++ Programming forums, part of the General Programming Boards category; ok, this program that i'm making worked just fine while using Dev-C++, and GCC, but when i moved it to ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    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:
    Code:
    Linking...
    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
    Location
    Singapore
    Posts
    21,717
    Have you tested with a "hello world" program?

    Oh, and why are you using MSVC6? Use a newer compiler, unless you have no choice.
    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
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    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
    Posts
    224
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    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, 08:32 AM
  2. what to do with the main window
    By stallion in forum Windows Programming
    Replies: 2
    Last Post: 01-28-2003, 07: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 Cprogramming.com
    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

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