Andre Poenitz wrote:
> On Fri, Dec 02, 2005 at 01:23:56AM +0000, Angus Leeming wrote:
>> 1. If there were some "make environment", by which I mean either an
>> MSVC solution file or a bunch of Makefiles that could be used to
>> invoke the MSVC compiler, then you'd find that the code compiled
>> (probably) but failed to link. That's because of some MSVC peculiarity
>> that regards 'structs' and 'classes' as different beasts (true in C#,
>> not in C++). The code in LyX is 'inconsistent' in this regard;
>> sometimes we use 'struct Foo' and elsewhere 'class Foo' for the same
>> 'Foo'. MSVC gets confused.
>
> As far as I know this raises only a compiler warning, not a linker
> problem.
I think not. Asger committed a stack of s/struct/class/ changes to avoid
linker problems not warnings. This machine is currently running linux, but
I'm pretty sure that the project below would fail to link. In fact, I've
seen similar errors with my own stuff, so know that there is a problem
here somewhere, even if it transpires that the code below does compile and
link.
Angus
// bar.h
struct Foo;
class Bar
{
public:
Bar(Foo const & foo);
};
// bar.cpp
#include "foo.h"
Bar::Bar(Foo const & foo)
{
foo.baz();
}
// foo.h
class Foo {
public:
void baz() const;
};
// foo.cpp
#include "foo.h"
void Foo::baz() const
{}
// main.cpp
#include "foo.h"
#include "bar.h"
int main()
{
Foo foo;
Bar(foo);
return 0;
}