Re: Compiling with .Net

From: Axel Naumann <axel-naumann_at_gmx.de>
Date: Fri, 11 Feb 2005 09:01:42 -0600


Hi Dimitris,
you need to add the custom build step generating the dictionary, _and_ you need to add the resulting files (the dictionary's .cxx and .h) to your project, so it gets compiled and linked. Axel.

Dimitris Sideris wrote:
>
> Hello,
> I have recently migrated to ROOT v4.02 and Visual .NET. I have tried to
> reproduce Francois-Xavier
> Gentit's instructions to build a simple test app, most of it goes well
> but I get unresolved externals. The same class used to compile before
> with ROOT 3.x and vc++6.
>
>
> ------ Build started: Project: fillgeometry, Configuration: Debug Win32
> ------
>
> Building Root dictionary for A
>
> Compiling...
>
> stdafx.cpp
>
> Compiling...
>
> fillgeometry.cpp
>
> AssemblyInfo.cpp
>
> a.cpp
>
> Generating Code...
>
> Compiling resources...
>
> Linking...
>
> a.obj : error LNK2001: unresolved external symbol "public: virtual void
> __thiscall A::Streamer(class TBuffer &)" (?Streamer_at_A@@UAEXAAVTBuffer@@@Z)
>
> a.obj : error LNK2001: unresolved external symbol "public: virtual void
> __thiscall A::ShowMembers(class TMemberInspector &,char *)"
> (?ShowMembers_at_A@@UAEXAAVTMemberInspector@@PAD_at_Z)
>
> a.obj : error LNK2001: unresolved external symbol "public: static class
> TClass * __cdecl A::Class(void)" (?Class_at_A@@$$FSAPAVTClass@@XZ)
>
> a.obj : error LNK2001: unresolved external symbol "class
> ROOT::TGenericClassInfo * __cdecl ROOT::GenerateInitInstance(class A
> const *)"
> (?GenerateInitInstance_at_ROOT@@$$FYAPAVTGenericClassInfo_at_1@PBVA@@@Z)
>
> C:\root-projects\fillgeometry\Debug\fillgeometry.exe : fatal error
> LNK1120: 4 unresolved externals
>
> Build log was saved at
> "file://c:\root-projects\fillgeometry\fillgeometry\Debug\BuildLog.htm"
>
> fillgeometry - 5 error(s), 0 warning(s)
>
>
>
> ---------------------- Done ----------------------
>
> Build: 0 succeeded, 1 failed, 0 skipped
>
>
>
>
>
> Class A is as follows:
>
> a.h********
>
> // myclass.h: interface for the myclass class.
>
> //
>
> //////////////////////////////////////////////////////////////////////
>
> #ifndef __A_HH__
>
> #define __A_HH__
>
>
>
>
>
>
>
> #if _MSC_VER >= 1000
>
> #pragma once
>
> #endif // _MSC_VER >= 1000
>
> #include "TObject.h"
>
>
>
> class A : public TObject {
>
> public :
>
> A();
>
> virtual ~A();
>
> // Float_t rv[300];
>
> Float_t t_scan();
>
> Float_t t_min();
>
> Float_t v(Int_t);
>
> Float_t v_streight(Int_t); // don't use offset/amplification
>
> Float_t v1(Int_t);
>
> Float_t v1_streight(Int_t); // don't use offset/amplification
>
> Float_t v2(Int_t);
>
> Float_t v2_streight(Int_t); // don't use offset/amplification
>
> void SetAmplifier(Float_t, Float_t);
>
> Float_t GetOffset();
>
> Float_t GetAmpFactor();
>
> void SetAdcOneVolt(Float_t);
>
> Float_t GetAdcOneVolt();
>
> void SetNumberOfPixels(Short_t );
>
> Short_t GetNumberOfPixels();
>
> void SetReadoutSpeed(Float_t ); //Hz
>
> Float_t GetReadoutSpeed();
>
> Float_t GetZeroCounts(); // baseline in adc counts
>
> void SetZeroCounts(Float_t);
>
> // variables
>
> Float_t rv[1025]; // first channel
>
> Float_t rv2[1025]; // second channel
>
> Int_t time;
>
> Float_t amplificationFactor; // amplifier
>
> Float_t vOffset; // pedestal
>
> Float_t adcOneVolt; // 1 V in ADC counts
>
> Short_t pdaNumberOfPixels;
>
> Float_t daqReadoutSpeed;
>
> Float_t adcZeroCounts; // baseline value in ADC counts e.g. ~ -400
>
>
>
> private :
>
> //
>
> ClassDef(A,1) //My small class example
>
> };
>
>
>
> #endif
>
>
>
> **********a.cpp***********************
>
> #include "A.h"
>
>
>
> ClassImp(A)
>
> A::A() {
>
> for ( int i=0;i<=1024;i++) { rv[i]=0;};
>
> time = 0;
>
> vOffset=0; // no offset
>
> amplificationFactor=-1.; // inversion but no amplification
>
> adcOneVolt=6200; //ICS 652 14bit approx
>
> adcZeroCounts=-400; // approx - baseline in adc counts
>
> daqReadoutSpeed=10; //Hz
>
> pdaNumberOfPixels=512;
>
> }
>
> A::~A() {
>
> //
>
> }
>
>
>
> Float_t A::t_scan() { return (Float_t(time)); }
>
> Float_t A::t_min() { return Float_t(time)/60./daqReadoutSpeed; }
>
> Float_t A::v(Int_t pixel) { return
> ((rv[pixel]-adcZeroCounts)/adcOneVolt-vOffset)/amplificationFactor; }
>
> Float_t A::v_streight(Int_t pixel) { return rv[pixel]; }
>
> Float_t A::v1(Int_t pixel) { return v(pixel); }
>
> Float_t A::v1_streight(Int_t pixel) { return rv[pixel]; }
>
> Float_t A::v2(Int_t pixel) { return
> ((rv2[pixel]-adcZeroCounts)/adcOneVolt-vOffset)/amplificationFactor; }
>
> Float_t A::v2_streight(Int_t pixel) { return rv2[pixel]; }
>
> Float_t A::GetOffset() { return vOffset; }
>
> Float_t A::GetAmpFactor() { return amplificationFactor; }
>
> void A::SetAdcOneVolt(Float_t onevolt) { adcOneVolt=onevolt; }
>
> Float_t A::GetAdcOneVolt() { return adcOneVolt; }
>
> void A::SetNumberOfPixels(Short_t pix) { pdaNumberOfPixels=pix; }
>
> Short_t A::GetNumberOfPixels() { return pdaNumberOfPixels; }
>
> void A::SetReadoutSpeed(Float_t readout){ daqReadoutSpeed=readout; }
>
> Float_t A::GetReadoutSpeed() { return daqReadoutSpeed; }
>
> void A::SetZeroCounts(Float_t zc) { adcZeroCounts=zc; }
>
> Float_t A::GetZeroCounts() { return adcZeroCounts; }
>
> void A::SetAmplifier(Float_t v, Float_t offset)
>
> {
>
> vOffset= offset;
>
> amplificationFactor=v;
>
> }
>
> //*********************
>
>
>
Received on Fri Feb 11 2005 - 16:01:51 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET