czimaginginstitute / MotionCor3

Anisotropic correction of beam induced sample motion for cryo-electron microscopy and tomography
BSD 3-Clause "New" or "Revised" License
41 stars 2 forks source link

compiling issue "error: ‘DU’ does not name a type" #5

Open nym4432018 opened 8 months ago

nym4432018 commented 8 months ago

Correct/CCorrectFullShift.cpp:15:1: error: reference to ‘DU’ is ambiguous DU::CDataPackage CCorrectFullShift::m_pPackage = 0L; ^ In file included from Correct/CCorrectFullShift.cpp:1:0: Correct/CCorrectInc.h:14:24: note: candidates are: namespace MotionCor2::Correct::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = DataUtil; ^ In file included from Correct/../MotionDecon/../Align/CAlignInc.h:2:0, from Correct/../MotionDecon/CMotionDeconInc.h:4, from Correct/CCorrectInc.h:4, from Correct/CCorrectFullShift.cpp:1: Correct/../MotionDecon/../Align/../CMainInc.h:12:36: note: namespace MotionCor2::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ Correct/CCorrectFullShift.cpp:15:1: error: ‘DU’ does not name a type DU::CDataPackage CCorrectFullShift::m_pPackage = 0L; ^ make: *** [Correct/CCorrectFullShift.o] Error

gcc: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) nvidia: Driver Version: 535.104.05 CUDA Version: 12.2

PengxinChai commented 8 months ago

Have you resolved the issue?

nym4432018 commented 8 months ago

Have you resolved the issue?

No, it keeps occuring in our school cluster and the workstation.

homurachan commented 8 months ago

You can fix this issue by deleting the line: "namespace DU = DataUtil;", then replacing "DU" with "MotionCor2::DataUtil" in each of those files. Or you can try this fork: https://drive.google.com/file/d/17s6pbV4nx3emlUnfCuWehYqYtVYitfOq/view?usp=sharing

wlugmayr commented 8 months ago

i just run into the same error with CentOS7 and gcc 4.8.5. The problem is solved when using (in my case) gcc11 and cuda12.

nym4432018 commented 8 months ago

You can fix this issue by deleting the line: "namespace DU = DataUtil;", then replacing "DU" with "MotionCor2::DataUtil" in each of those files. Or you can try this fork: https://drive.google.com/file/d/17s6pbV4nx3emlUnfCuWehYqYtVYitfOq/view?usp=sharing

Thanks this worked.

szhengczii commented 8 months ago

@nym4432018: My apology for this bug. In Correct/CCorrectInc.h, please try by moving "namespace DU = DataUtil;" to above namespace since DataUtil is subspace of MotionCor2, not Correct.

namespace MotionCor2 { namespace DU = DataUtil; namespace Correct {.... } }

jychoi0616 commented 8 months ago

@nym4432018: My apology for this bug. In Correct/CCorrectInc.h, please try by moving "namespace DU = DataUtil;" to above namespace since DataUtil is subspace of MotionCor2, not Correct.

namespace MotionCor2 { namespace DU = DataUtil; namespace Correct {.... } }

Hi, I had the same error as this issue, and followed what you suggested here (correcting the CCorrectInc.h file). Then I got following errors:

MrcUtil/CLoadCryoEMStack.cpp:18:8: error: reference to \u2018DU\u2019 is ambiguous static DU::CStackFolder s_pStackFolder = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:15:36: note: candidates are: namespace DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ In file included from MrcUtil/CLoadCryoEMStack.cpp:2:0: MrcUtil/../CMainInc.h:12:36: note: namespace MotionCor2::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ MrcUtil/CLoadCryoEMStack.cpp:18:8: error: \u2018DU\u2019 does not name a type static DU::CStackFolder s_pStackFolder = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:19:8: error: reference to \u2018DU\u2019 is ambiguous static DU::CDataPackage s_pPackage = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:15:36: note: candidates are: namespace DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ In file included from MrcUtil/CLoadCryoEMStack.cpp:2:0: MrcUtil/../CMainInc.h:12:36: note: namespace MotionCor2::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ MrcUtil/CLoadCryoEMStack.cpp:19:8: error: \u2018DU\u2019 does not name a type static DU::CDataPackage s_pPackage = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:20:8: error: reference to \u2018DU\u2019 is ambiguous static DU::CFmIntegrateParam s_pFmIntParam = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:15:36: note: candidates are: namespace DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ In file included from MrcUtil/CLoadCryoEMStack.cpp:2:0: MrcUtil/../CMainInc.h:12:36: note: namespace MotionCor2::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ MrcUtil/CLoadCryoEMStack.cpp:20:8: error: \u2018DU\u2019 does not name a type static DU::CFmIntegrateParam s_pFmIntParam = 0L; ^ MrcUtil/CLoadCryoEMStack.cpp: In function \u2018void sDeletePackage()\u2019: MrcUtil/CLoadCryoEMStack.cpp:25:5: error: \u2018s_pPackage\u2019 was not declared in this scope if(s_pPackage == 0) return; ^ MrcUtil/CLoadCryoEMStack.cpp:26:9: error: \u2018s_pPackage\u2019 was not declared in this scope delete s_pPackage; ^ MrcUtil/CLoadCryoEMStack.cpp: In static member function \u2018static bool MotionCor2::MrcUtil::CLoadCryoEMStack::OpenFile(int)\u2019: MrcUtil/CLoadCryoEMStack.cpp:52:2: error: \u2018s_pStackFolder\u2019 was not declared in this scope s_pStackFolder = DU::CStackFolder::GetInstance(); ^ MrcUtil/CLoadCryoEMStack.cpp:53:2: error: \u2018s_pPackage\u2019 was not declared in this scope s_pPackage = s_pStackFolder->GetPackage(bPop); ^ MrcUtil/CLoadCryoEMStack.cpp: In static member function \u2018static void MotionCor2::MrcUtil::CLoadCryoEMStack::AsyncLoad()\u2019: MrcUtil/CLoadCryoEMStack.cpp:106:5: error: \u2018s_pPackage\u2019 was not declared in this scope if(s_pPackage == 0L) return; ^ MrcUtil/CLoadCryoEMStack.cpp:107:2: error: \u2018s_pFmIntParam\u2019 was not declared in this scope s_pFmIntParam = s_pPackage->m_pFmIntParam; ^ MrcUtil/CLoadCryoEMStack.cpp:107:18: error: \u2018s_pPackage\u2019 was not declared in this scope s_pFmIntParam = s_pPackage->m_pFmIntParam; ^ MrcUtil/CLoadCryoEMStack.cpp: In static member function \u2018static void MotionCor2::MrcUtil::CLoadCryoEMStack::GetPackage()\u2019: MrcUtil/CLoadCryoEMStack.cpp:116:5: error: \u2018s_pPackage\u2019 was not declared in this scope if(s_pPackage == 0L) return 0L; ^ MrcUtil/CLoadCryoEMStack.cpp:125:34: error: \u2018s_pPackage\u2019 was not declared in this scope DU::CDataPackage pRetPackage = s_pPackage; ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018virtual void MotionCor2::MrcUtil::CLoadCryoEMStack::ThreadMain()\u2019: MrcUtil/CLoadCryoEMStack.cpp:137:23: error: \u2018s_pPackage\u2019 was not declared in this scope m_pLoadMrc->OpenFile(s_pPackage->m_pcInFileName); ^ MrcUtil/CLoadCryoEMStack.cpp:139:5: error: \u2018s_pFmIntParam\u2019 was not declared in this scope if(s_pFmIntParam->NeedIntegrate()) mLoadInt(); ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018void MotionCor2::MrcUtil::CLoadCryoEMStack::mLoadSingle()\u2019: MrcUtil/CLoadCryoEMStack.cpp:156:35: error: \u2018s_pPackage\u2019 was not declared in this scope DataUtil::CMrcStack pMrcStack = s_pPackage->m_pRawStack; ^ MrcUtil/CLoadCryoEMStack.cpp:159:16: error: \u2018s_pFmIntParam\u2019 was not declared in this scope int iRawFm = s_pFmIntParam->GetIntFmStart(i); ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018void MotionCor2::MrcUtil::CLoadCryoEMStack::mLoadSingle4Bits()\u2019: MrcUtil/CLoadCryoEMStack.cpp:166:35: error: \u2018s_pPackage\u2019 was not declared in this scope DataUtil::CMrcStack pMrcStack = s_pPackage->m_pRawStack; ^ MrcUtil/CLoadCryoEMStack.cpp:175:17: error: \u2018s_pFmIntParam\u2019 was not declared in this scope { int iPkdFm = s_pFmIntParam->GetIntFmStart(i); ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018void MotionCor2::MrcUtil::CLoadCryoEMStack::mLoadInt()\u2019: MrcUtil/CLoadCryoEMStack.cpp:193:35: error: \u2018s_pPackage\u2019 was not declared in this scope DataUtil::CMrcStack pMrcStack = s_pPackage->m_pRawStack; ^ MrcUtil/CLoadCryoEMStack.cpp:200:22: error: \u2018s_pFmIntParam\u2019 was not declared in this scope { int iIntFmStart = s_pFmIntParam->GetIntFmStart(i); ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018void MotionCor2::MrcUtil::CLoadCryoEMStack::mLoadInt4Bits()\u2019: MrcUtil/CLoadCryoEMStack.cpp:220:35: error: \u2018s_pPackage\u2019 was not declared in this scope DataUtil::CMrcStack pMrcStack = s_pPackage->m_pRawStack; ^ MrcUtil/CLoadCryoEMStack.cpp:237:22: error: \u2018s_pFmIntParam\u2019 was not declared in this scope { int iIntFmStart = s_pFmIntParam->GetIntFmStart(i); ^ MrcUtil/CLoadCryoEMStack.cpp: In member function \u2018float MotionCor2::MrcUtil::CLoadCryoEMStack::mCalcMean(char)\u2019: MrcUtil/CLoadCryoEMStack.cpp:263:35: error: \u2018s_pPackage\u2019 was not declared in this scope DataUtil::CMrcStack* pMrcStack = s_pPackage->m_pRawStack; ^ make: *** [MrcUtil/CLoadCryoEMStack.o] Error 1

szhengczii commented 8 months ago

@nym4432018: This is a bug in CMainInc.h. Please replace "namespace DU = MotionCor2::DataUtil;" with "namespace DU = DataUtil;"

I am wondering my compiler (g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)) cannot catch this error. Can you please let me know what g++ version you use? You can run "g++ --version". Thanks.

sunchang1990 commented 1 month ago

@szhengczii: I have observed a related compiling issue when I use the devtoolset_7 on CentOS 7. The error message is listed below for your reference. Correct/CCorrectFullShift.cpp:15:1: error: reference to ‘DU’ is ambiguous DU::CDataPackage* CCorrectFullShift::m_pPackage = 0L; ^~ In file included from Correct/CCorrectFullShift.cpp:1:0: Correct/CCorrectInc.h:13:24: note: candidates are: namespace MotionCor2::Correct::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = DataUtil; ^ In file included from Correct/../MotionDecon/../Align/CAlignInc.h:2:0, from Correct/../MotionDecon/CMotionDeconInc.h:4, from Correct/CCorrectInc.h:4, from Correct/CCorrectFullShift.cpp:1: Correct/../MotionDecon/../Align/../CMainInc.h:12:36: note: namespace MotionCor2::DU = MotionCor2::MotionCor2::DataUtil; namespace DU = MotionCor2::DataUtil; ^ make: *** [makefile11:177: Correct/CCorrectFullShift.o] Error 1 However, when I switched to devtoolset_8 or devtoolset_9, the compiling error is gone and the compiled MotionCor3 is functional. Thus, it appears this is a compiler dependent bug.