LNK2001: unresolved external symbol _G__cpp_setupG__Graf1

Dear Rooters

I have just upgraded root on WinXP from 5.20/00 to 5.22/00 and tried to compile my program.
For some reason I get suddenly the following error:

xpsDict.cxx
"C:\Programme\Microsoft Visual Studio 9.0\VC\bin/link" /dll /def:xps.def /out:xp
s.dll fp10.obj  -opt:noref  -nologo -include:_G__cpp_setupG__Hist -include:_G__c
pp_setupG__Graf1 -include:_G__cpp_setupG__G3D -include:_G__cpp_setupG__GPad -inc
lude:_G__cpp_setupG__Tree -include:_G__cpp_setupG__Rint -include:_G__cpp_setupG_
_PostScript -include:_G__cpp_setupG__Matrix -include:_G__cpp_setupG__Physics -in
clude:_G__cpp_setupG__Ged  "C:\root/lib/libCore.lib" "C:\root/lib/libCint.lib" "
C:\root/lib/libHist.lib" "C:\root/lib/libGraf.lib" "C:\root/lib/libGraf3d.lib" "
C:\root/lib/libGpad.lib" "C:\root/lib/libTree.lib" "C:\root/lib/libRint.lib" "C:
\root/lib/libPostscript.lib" "C:\root/lib/libMatrix.lib" "C:\root/lib/libPhysics
.lib" "C:\root/lib/libNet.lib" "C:\root/lib/libRIO.lib" "C:\root/lib/libMathCore
.lib" "C:\root/lib/libGui.lib" "C:\root/lib/libGraf.lib" "C:\root/lib/libGpad.li
b" "C:\root/lib/libGed.lib" "C:\root/lib/libTreePlayer.lib" "C:\root/lib/libTree
Viewer.lib" *.obj
   Creating library xps.lib and object xps.exp
LINK : error LNK2001: unresolved external symbol _G__cpp_setupG__Graf1
xps.dll : fatal error LNK1120: 1 unresolved externals
make[3]: *** [xps.dll] Error 96
make[2]: *** [srcDynlib] Error 2

The relevant part of my Makefile.win is:

LDFLAGS       = $(LDOPT) $(conlflags) -nologo -include:_G__cpp_setupG__Hist \
                -include:_G__cpp_setupG__Graf1 -include:_G__cpp_setupG__G3D \
                -include:_G__cpp_setupG__GPad -include:_G__cpp_setupG__Tree \
                -include:_G__cpp_setupG__Rint -include:_G__cpp_setupG__PostScript \
                -include:_G__cpp_setupG__Matrix -include:_G__cpp_setupG__Physics \
                -include:_G__cpp_setupG__Ged 
SOFLAGS       = $(dlllflags:-pdb:none=)
ROOTLIBS      = "${ROOTSYS}/lib/libCore.lib" \
                "${ROOTSYS}/lib/libCint.lib" "${ROOTSYS}/lib/libHist.lib" \
                "${ROOTSYS}/lib/libGraf.lib" "${ROOTSYS}/lib/libGraf3d.lib" \
                "${ROOTSYS}/lib/libGpad.lib" "${ROOTSYS}/lib/libTree.lib" \
                "${ROOTSYS}/lib/libRint.lib" "${ROOTSYS}/lib/libPostscript.lib" \
                "${ROOTSYS}/lib/libMatrix.lib" "${ROOTSYS}/lib/libPhysics.lib" \
                "$(ROOTSYS)/lib/libNet.lib" "$(ROOTSYS)/lib/libRIO.lib" \
                "$(ROOTSYS)/lib/libMathCore.lib"
LIBS          = $(ROOTLIBS)
GLIBS         = $(LIBS) "${ROOTSYS}/lib/libGui.lib" "${ROOTSYS}/lib/libGraf.lib" \
                "${ROOTSYS}/lib/libGpad.lib" "${ROOTSYS}/lib/libGed.lib" \
                "${ROOTSYS}/lib/libTreePlayer.lib" "${ROOTSYS}/lib/libTreeViewer.lib"
LIBSALL       = $(ROOTLIBS)

Do you know what the reason for this error could be?
Am I missing some library?

Thank you in advance
Best regards
Christian

Hi Christian,

In your makefile, please replace: -include:_G__cpp_setupG__Graf1 by -include:_G__cpp_setupG__Graf
Cheers, Bertrand.

Dear Bertrand

Thank you very much, this solved my problem.

One question: Will this change affect older root versions, especially root_v5.18/00?

Best regards
Christian

Hi Christian,

ROOT v5.18/00 is still using -include:_G__cpp_setupG__Graf1. This has changed in revision 24708:
http://root.cern.ch/viewvc/trunk/Makefile?view=diff&r1=24708&r2=24709

Cheers, Bertrand.

Dear Bertrand

Thank you , this is really bad news since this means root_v5.18/00 will not compile with the new
setting and root_v5.22/00 will not compile with the old setting.

Is there a way to change the Makefile.win in a way that it can be used with both root versions?

Best regards
Christian

Hi Christian,

Sure! Yo can try something like this:

[code]!if ([findstr /c:"-include:_G__cpp_setupG__Graf1" $(ROOTSYS)\bin\root-config > nul ] == 0)
WHICHGRAF =_G__cpp_setupG__Graf1
!else
WHICHGRAF =_G__cpp_setupG__Graf
!endif

LDFLAGS = $(LDOPT) $(conlflags) -nologo -include:_G__cpp_setupG__Hist \
-include:$(WHICHGRAF) -include:_G__cpp_setupG__G3D \
-include:_G__cpp_setupG__GPad -include:_G__cpp_setupG__Tree \
-include:_G__cpp_setupG__Rint -include:_G__cpp_setupG__PostScript \
-include:_G__cpp_setupG__Matrix -include:_G__cpp_setupG__Physics \
-include:_G__cpp_setupG__Ged [/code]
Cheers,
Bertrand.

Dear Bertrand

Thank you very much, it works great as long as I compile using NMAKE.

However, I need to compile it from within R which uses MinGW, and there I get the error:

Makefile.win:6: *** target pattern contains no `%'.  Stop.

Trying to understand what this means I found the following links:
ss64.com/nt/findstr.html
nabble.com/Target-pattern-co … 23698.html

The first link explains to me what findstr does: findstr /C:string
The second link tells me that MinGW make does not like the “:”, however I have no idea how to solve this problem.

Do you have any idea?

Best regards
Christian

Dear Bertrand

Meanwhile I found the following solution which seems to work:

ifneq ($(findstring _G__cpp_setupG__Graf1, ${ROOTSYS}/bin/root-config),)
WHICHGRAF =_G__cpp_setupG__Graf1
else
WHICHGRAF =_G__cpp_setupG__Graf
endif

Can you confirm that this solution is correct, or is there still a hidden problem?

Best regards
Christian

Hi Christian,

This looks just fine to me :slight_smile:

Cheers,
Bertrand.

Great, thank you. Christian