[LLVMdev] struct and class under VC7.1

Jeff Cohen jeffc at jolt-lang.org
Thu Sep 23 07:08:03 PDT 2004


MSVC++ is picky about this.  It considers classes and structs to be
different types so you have to be consistent.  If you forward declared a
struct as a class within the same compilation unit, it would complain
about that too.  It's not just linking.

On Thu, 23 Sep 2004 15:59:42 +0200
Paolo Invernizzi <arathorn at fastwebnet.it> wrote:

> Hi all,
> 
> Finally I managed to find out a strange problem under Visual C
> 
> During the link of the HowToUseJIT program, I was always missing some 
> symbols... and I was going crazy testing out different options...
> 
> At the end, unmangling the differences in what linker was searching and 
> what was present in the libraries, I found that the problem is
> that we have something like this...
> 
> Value.h
> struct Value {
> 	bla bla bla
> }
> 
> and around in the other files:
> SlotCalculator.h
> SchedGraph.h
> <big snip>
> 
> class Value;
> 
> The linker complains about the different parameters types, and raise an 
> unresolved external symbol.
> 
> I can resolve the iussue
> a) turning the original struct Value { ... } in class Value { public: 
> .... }
> b) turning all the class Value; into struct Value;
> 
> The same is for TargetJITInfo, Type, IntrinsicLowering and others...
> 
> Suggestions?
> 
> ---
> Paolo Invernizzi
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list