Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Getting "LINK : Fetal error LNK1561 : entry point must be defined" while creating managed C++ dll in VS2005

Getting "LINK : Fetal error LNK1561 : entry point must be defined" while creating managed C++ dll in VS2005

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpcsharpcssdotnet
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cracked Down
    wrote on last edited by
    #1

    HI all, I am getting this error since morning, I am clue less as I am working first time on it (I am c# developer). the code file are as follows and i compied using Commnad prompt command cl /clr:oldSyntax DemoCPP.cpp DemoCPP.cpp class

    #include "DemoHeader.h"

    DemoCPP::DemoCPP()
    : Length(0.00), Height(0.00)
    {
    }

    DemoCPP::DemoCPP(double L, double H)
    : Length(L), Height(H)
    {
    }

    DemoCPP::~DemoCPP()
    {
    }

    double DemoCPP::getLength()
    {
    return Length;
    }

    void DemoCPP::setLength(double L)
    {
    Length = L;
    }

    double DemoCPP::getHeight()
    {
    return Height;
    }

    void DemoCPP::setHeight(double H)
    {
    Height = H;
    }

    void DemoCPP::setDimensions(double L, double H)
    {
    setLength(L);
    setHeight(H);
    }

    double DemoCPP::Perimeter()
    {
    return 2 * (Length + Height);
    }

    double DemoCPP::Area()
    {
    return Length * Height;
    }

    header file DemoHeader.h

    #pragma once
    #using <mscorlib.dll>

    __gc class DemoCPP
    {
    public:
    DemoCPP();
    DemoCPP(double L, double H);
    ~DemoCPP();
    double getLength();
    void setLength(double L);
    double getHeight();
    void setHeight(double H);
    void setDimensions(double L, double H);
    double Perimeter();
    double Area();
    private:
    double Length;
    double Height;
    };

    any body have any idea how to resolve this problem? thanks in advance!

    K N 2 Replies Last reply
    0
    • C Cracked Down

      HI all, I am getting this error since morning, I am clue less as I am working first time on it (I am c# developer). the code file are as follows and i compied using Commnad prompt command cl /clr:oldSyntax DemoCPP.cpp DemoCPP.cpp class

      #include "DemoHeader.h"

      DemoCPP::DemoCPP()
      : Length(0.00), Height(0.00)
      {
      }

      DemoCPP::DemoCPP(double L, double H)
      : Length(L), Height(H)
      {
      }

      DemoCPP::~DemoCPP()
      {
      }

      double DemoCPP::getLength()
      {
      return Length;
      }

      void DemoCPP::setLength(double L)
      {
      Length = L;
      }

      double DemoCPP::getHeight()
      {
      return Height;
      }

      void DemoCPP::setHeight(double H)
      {
      Height = H;
      }

      void DemoCPP::setDimensions(double L, double H)
      {
      setLength(L);
      setHeight(H);
      }

      double DemoCPP::Perimeter()
      {
      return 2 * (Length + Height);
      }

      double DemoCPP::Area()
      {
      return Length * Height;
      }

      header file DemoHeader.h

      #pragma once
      #using <mscorlib.dll>

      __gc class DemoCPP
      {
      public:
      DemoCPP();
      DemoCPP(double L, double H);
      ~DemoCPP();
      double getLength();
      void setLength(double L);
      double getHeight();
      void setHeight(double H);
      void setDimensions(double L, double H);
      double Perimeter();
      double Area();
      private:
      double Length;
      double Height;
      };

      any body have any idea how to resolve this problem? thanks in advance!

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      google hits: http://msdn.microsoft.com/en-us/library/ky737ya4%28VS.80%29.aspx[^] Did you create your dll project with a wizard. (If not do it)

      Press F1 for help or google it. Greetings from Germany

      1 Reply Last reply
      0
      • C Cracked Down

        HI all, I am getting this error since morning, I am clue less as I am working first time on it (I am c# developer). the code file are as follows and i compied using Commnad prompt command cl /clr:oldSyntax DemoCPP.cpp DemoCPP.cpp class

        #include "DemoHeader.h"

        DemoCPP::DemoCPP()
        : Length(0.00), Height(0.00)
        {
        }

        DemoCPP::DemoCPP(double L, double H)
        : Length(L), Height(H)
        {
        }

        DemoCPP::~DemoCPP()
        {
        }

        double DemoCPP::getLength()
        {
        return Length;
        }

        void DemoCPP::setLength(double L)
        {
        Length = L;
        }

        double DemoCPP::getHeight()
        {
        return Height;
        }

        void DemoCPP::setHeight(double H)
        {
        Height = H;
        }

        void DemoCPP::setDimensions(double L, double H)
        {
        setLength(L);
        setHeight(H);
        }

        double DemoCPP::Perimeter()
        {
        return 2 * (Length + Height);
        }

        double DemoCPP::Area()
        {
        return Length * Height;
        }

        header file DemoHeader.h

        #pragma once
        #using <mscorlib.dll>

        __gc class DemoCPP
        {
        public:
        DemoCPP();
        DemoCPP(double L, double H);
        ~DemoCPP();
        double getLength();
        void setLength(double L);
        double getHeight();
        void setHeight(double H);
        void setDimensions(double L, double H);
        double Perimeter();
        double Area();
        private:
        double Length;
        double Height;
        };

        any body have any idea how to resolve this problem? thanks in advance!

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Since this is a DLL, you need to compile with /DLL compiler switch. BTW, why are you using old syntax?

        Navaneeth How to use google | Ask smart questions

        C 2 Replies Last reply
        0
        • N N a v a n e e t h

          Since this is a DLL, you need to compile with /DLL compiler switch. BTW, why are you using old syntax?

          Navaneeth How to use google | Ask smart questions

          C Offline
          C Offline
          Cracked Down
          wrote on last edited by
          #4

          Thanks for quick response! Yes I have googled a lot and then placed question here... the Old command i am using because it is recommended by the VS2005 when i tried to build the project from vs2005 I tried the project type as empty project as well as class library! still I am getting the same error! I have created the project using wizard itself! any further help! thanks in advance!

          N 1 Reply Last reply
          0
          • C Cracked Down

            Thanks for quick response! Yes I have googled a lot and then placed question here... the Old command i am using because it is recommended by the VS2005 when i tried to build the project from vs2005 I tried the project type as empty project as well as class library! still I am getting the same error! I have created the project using wizard itself! any further help! thanks in advance!

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            If you have VS, don't do command compilation. I never came across a situation where VS recommended old syntax. If you need to create a fully managed assembly, choose Class Library project type. Use new syntax and compile using /clr:safe. if you need to communicate with native libraries, compile with /clr switch which will produce mixed assemblies. Since you have VS IDE, best option is to use it to compile rather than doing through command. VS does things like manifest embedding automatically.

            Navaneeth How to use google | Ask smart questions

            C 1 Reply Last reply
            0
            • N N a v a n e e t h

              Since this is a DLL, you need to compile with /DLL compiler switch. BTW, why are you using old syntax?

              Navaneeth How to use google | Ask smart questions

              C Offline
              C Offline
              Cracked Down
              wrote on last edited by
              #6

              I got the Answer :) here it is 1. Project Properties -> General Tab 2. for Common Language Runtime Support select Old Syntax (/clr:oldSyntax) from drop down now you do not need to play with command line .....:) you can easily build your project from visual studio IDE itself

              1 Reply Last reply
              0
              • N N a v a n e e t h

                If you have VS, don't do command compilation. I never came across a situation where VS recommended old syntax. If you need to create a fully managed assembly, choose Class Library project type. Use new syntax and compile using /clr:safe. if you need to communicate with native libraries, compile with /clr switch which will produce mixed assemblies. Since you have VS IDE, best option is to use it to compile rather than doing through command. VS does things like manifest embedding automatically.

                Navaneeth How to use google | Ask smart questions

                C Offline
                C Offline
                Cracked Down
                wrote on last edited by
                #7

                thanks navneeth for ypur reply I tried using /clr:safe option however i got the following error

                Error 1 error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option d:\excercise\dot net\cppclasslibrary\cppclasslibrary\CPPCLassLibrary.h

                8 so as suggested I used the /clr:oldSyntax and option _gc I am using as i want to consume this class libray in c#

                N 1 Reply Last reply
                0
                • C Cracked Down

                  thanks navneeth for ypur reply I tried using /clr:safe option however i got the following error

                  Error 1 error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option d:\excercise\dot net\cppclasslibrary\cppclasslibrary\CPPCLassLibrary.h

                  8 so as suggested I used the /clr:oldSyntax and option _gc I am using as i want to consume this class libray in c#

                  N Offline
                  N Offline
                  N a v a n e e t h
                  wrote on last edited by
                  #8

                  Here is your class using new syntax.

                  #pragma once

                  using namespace System;

                  ref class DemoCPP
                  {
                  public:
                  DemoCPP();
                  DemoCPP(double L, double H);
                  ~DemoCPP();
                  double getLength();
                  void setLength(double L);
                  double getHeight();
                  void setHeight(double H);
                  void setDimensions(double L, double H);
                  double Perimeter();
                  double Area();
                  private:
                  double Length;
                  double Height;
                  };

                  Now compile using /clr or /clr:safe.

                  Navaneeth How to use google | Ask smart questions

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups