Help - about cc

Help
nethz
2007-04-24
2013-04-24
  • nethz

    nethz - 2007-04-24

    when I use ant, I get this error.

    Buildfile: build.xml

    init:

    hello:
          [cc] 1 total files to be compiled.
          [cc] hello.c
          [cc] Starting link
          [cc] MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _tmainCrtStatup
          [cc] hello.exe : fatal error LNK2230: 1 unresolved externals

    BUILD FAILED

    this is my build.xml

    <?xml version="1.0"?>
    <project name="Hello" default="hello" basedir=".">
      <taskdef resource="cpptasks.tasks"/>
      <typedef resource="cpptasks.types"/>
      <target name="init">
        <condition property="cc" value="msvc">
           <os family="windows"/>
        </condition>
        <condition property="cc" value="gcc">
           <os family="unix"/>
        </condition>
      </target>
      <target name="hello" depends="init">
         <cc name="${cc}" outfile="hello">
           <fileset dir="." includes="hello.c"/>
         </cc>
       </target>
    </project>

    and this is my hello.c

    int main()
    {
    return 0;
    }

     
    • Curt Arnold

      Curt Arnold - 2007-04-24

      And a susbsystem="console" to your cc element.  Otherwise, MSVC thinks that you are linking a Windows application and expects a WinMain entry point.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks