Re: Repost: easy include question



On Mon, 19 Sep 2005 06:39:02 -0700, "Maynard"
<Maynard@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>I have created a class (MyClass), and have updated the include path to
>include the directory (MyDir) where MyClass resides. When I then create new
>code that uses MyClass, I cannot simply enter "#include <MyDir\MyClass.h>"; I
>have to load MyClass source and header to the project. This doesn't seem
>right...what am I missing? If I don't add MyClass source and header to the
>project, I get unresolved external link errors.

Ah. It's the source file that's the issue, not the header file. Unless the
implementation of what the header represents is part of some library you're
linking to, you'll have to add the source file to your project, so that it
will be compiled into an object file you will link to.

--
Doug Harrison
VC++ MVP
.



Relevant Pages

  • Re: Help With Nesting Classes In Library
    ... I have one main file that contains a header and several, ... MyClass someclass = new MyClass; ... public static int MyCode ... I want to be able to reference this dll to other projects and then use ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: PyDev multiple source files?
    ... therefore to 'include' access to 'myclass' in file xyz.py from another file called 'abc.py' you would put this in abc.py ... imports etc, doing wxpython stuff blah, blah, blah. ... Now I want to be able to break my single source file up into multiple ... equivalent of 'include' statements in there with all my globals ...
    (comp.lang.python)
  • Re: Is there anyway to forward reference a namespace like STL?
    ... class MyClass; ... class AnotherClass ... This way I do not need to include the header to MyClass in the header for AnotherClass. ...
    (microsoft.public.vc.language)
  • Re: LNK2001: unresolved external
    ... > class MyClass ... claiming that it cant find CMyClass's destructor. ... > Strip out the destructor from the original CPP and move it to the header ...
    (microsoft.public.vc.mfc)
  • Re: Help With Nesting Classes In Library
    ... need to read a header from the binary file, and it will also need to ... is nested inside MyClass: you're just setting a static property of the ... public static int MyCode ...
    (microsoft.public.dotnet.languages.csharp)