3.1.0 Compiling unresolved external symbol _main

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoWizard
    Adept
    • Dec 2008
    • 102

    3.1.0 Compiling unresolved external symbol _main

    Anyone can help with this error, I cant find out why.

    Code:
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Angband.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    That is the error popping up, I was able to compile prior to 309, but I cant seem to find why it's not working anymore.

    Any help appreciated.

    or should I just flush Visual Studio 6 and go for another compiler?
    NeoWizard
    -. . --- .-- .. --.. .- .-. -..

    aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. fi yuo cna raed tihs, palce it in yuor siantugre. Olny 55% of plepoe can. mtat
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #2
    Originally posted by NeoWizard
    Anyone can help with this error, I cant find out why.

    Code:
    Linking...
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/Angband.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    That is the error popping up, I was able to compile prior to 309, but I cant seem to find why it's not working anymore.

    Any help appreciated.

    or should I just flush Visual Studio 6 and go for another compiler?
    Is there any way to get ahold of what VS is calling the compiler and linker with? I guess there's a file not being compiled/linked somewhere.
    takkaria whispers something about options. -more-

    Comment

    • Antoine
      Ironband/Quickband Maintainer
      • Nov 2007
      • 1010

      #3
      Originally posted by NeoWizard
      Anyone can help with this error, I cant find out why.

      Code:
      Linking...
      LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
      Debug/Angband.exe : fatal error LNK1120: 1 unresolved externals
      Error executing link.exe.
      That is the error popping up, I was able to compile prior to 309, but I cant seem to find why it's not working anymore.

      Any help appreciated.

      or should I just flush Visual Studio 6 and go for another compiler?
      I've been VS6ing and managed to get it working with a one-line change to the makefile... forgotten what though. Can check when I get home if needed

      A.
      Ironband - http://angband.oook.cz/ironband/

      Comment

      • NeoWizard
        Adept
        • Dec 2008
        • 102

        #4
        Originally posted by takkaria
        Is there any way to get ahold of what VS is calling the compiler and linker with? I guess there's a file not being compiled/linked somewhere.
        I guess by the name of the obj file generating the error it would be a file name crt0.c but I dont have any crt0 source files in any of the project source files.

        I hope my description of the error is not too complicated.

        for the rest I don't know how I can get you the information as to what VS is calling the compiler with. If you could point me in the right direction. The last time I used VS was when I quit my job as a programmer, some yrs ago.
        NeoWizard
        -. . --- .-- .. --.. .- .-. -..

        aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. fi yuo cna raed tihs, palce it in yuor siantugre. Olny 55% of plepoe can. mtat

        Comment

        • Pete Mack
          Prophet
          • Apr 2007
          • 6883

          #5
          crt0.c is the name of the default windows linkage in MVC for console programs. I suspect you need to fix your compile line so that it links in WinMain. I don't remember the details.

          Comment

          • NeoWizard
            Adept
            • Dec 2008
            • 102

            #6
            Originally posted by Pete Mack
            crt0.c is the name of the default windows linkage in MVC for console programs. I suspect you need to fix your compile line so that it links in WinMain. I don't remember the details.
            Ya I tried that, and found some info on MSDN, but nothing worked, so I gave up, installed DevC++ 5 beta and after configuring everything and a couple modificationd to some #include statements, everything compiles and plays right.

            Conclusion, I'll uninstall VS and continue on with Dev-C++.
            NeoWizard
            -. . --- .-- .. --.. .- .-. -..

            aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. fi yuo cna raed tihs, palce it in yuor siantugre. Olny 55% of plepoe can. mtat

            Comment

            • Stefan O'Rear
              Rookie
              • Jan 2009
              • 1

              #7
              Originally posted by NeoWizard
              Anyone can help with this error, I cant find out why.

              Code:
              Linking...
              LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
              Debug/Angband.exe : fatal error LNK1120: 1 unresolved externals
              Error executing link.exe.
              That is the error popping up, I was able to compile prior to 309, but I cant seem to find why it's not working anymore.

              Any help appreciated.

              or should I just flush Visual Studio 6 and go for another compiler?
              Apparently Visual C has decided to use the 'stdcall' calling convention, which results in names like main@8, instead of the 'ccall' calling convention, which results in names like '_main'. Alternatively, it is trying to compile a console program (name '_main') when it needs to be looking for a screen program (name 'WinMain@8'). Look for options related to default calling conventions and 'subsystem'.

              crt0.o is a file in the standard library which runs as the first thing in any program; it mediates the differences between the OS's method for calling programs, and the standard C way of being called.

              Comment

              Working...
              😀
              😂
              🥰
              😘
              🤢
              😎
              😞
              😡
              👍
              👎