PDA

View Full Version : Using CCfits library in Win 7 with MSVC 2008



vrltwe
13th October 2013, 18:16
I'm trying to use the CCfits library in a Qt Creator project in Windows 7 32 bits. Please find the files appended.

I builded the libs (CCfits depends on CFITSIO) from source and I actually can build and run a VS sample project which comes with CCfits, which is found in the cookbook folder of CCfits.

The problem is how to run the same project on Qt Creator. I'm assuming that if it runs on VS it must be possible to run in Qt Creator (using the MSVC compiler).

I installed the following packets:
- Visual Studio Express 2008
- qt-win-opensource-4.8.5-vs2008
- Windows kit 8
- qt-creator-windows-opensource-2.8.1

The following is part of the compile output, which presents "already defined" issue:


msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned short * __thiscall std::allocator<unsigned short>::allocate(unsigned int)" (?allocate@?$allocator@G@std@@QAEPAGI@Z) already defined in CCfits.lib(ColumnCreator.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: void __thiscall std::allocator<unsigned short>::deallocate(unsigned short *,unsigned int)" (?deallocate@?$allocator@G@std@@QAEXPAGI@Z) already defined in CCfits.lib(ColumnCreator.obj)
release\CCfits-test.exe : fatal error LNK1169: one or more multiply defined symbols found
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.EXE"' : return code '0x491'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
13:36:24: The process "C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe" exited with code 2.
Error while building/deploying project CCfits-test (kit: MSVC2008)
When executing step 'Make'

I would like to ask how to procced in order to solve this problem. Any suggestion will be appreciated.

Thanks in advance.

9692

9691

ChrisW67
13th October 2013, 21:05
The error indicates that Microsoft's linker cannot link your third party source because of name clashes between symbols in CCFits.lib and the Microsoft C++ run time library. My guess is that your compiler command is missing an option (a preprocessor define in all likelihood) that adjusts the offending code in CcFits.

This has no direct connection with Qt ( a library) or Qt Creator (an editor that can run make).

vrltwe
13th October 2013, 23:14
Using jom instead of nmake, then I get the following:


msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: unsigned short * __thiscall std::allocator<unsigned short>::allocate(unsigned int)" (?allocate@?$allocator@G@std@@QAEPAGI@Z) already defined in CCfits.lib(ColumnCreator.obj)
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: void __thiscall std::allocator<unsigned short>::deallocate(unsigned short *,unsigned int)" (?deallocate@?$allocator@G@std@@QAEXPAGI@Z) already defined in CCfits.lib(ColumnCreator.obj)
release\CCfits-test.exe : fatal error LNK1169: one or more multiply defined symbols found
jom: C:\Users\Cristiano\Documents\QtProjects\CCfits-test\Makefile.Release [release\CCfits-test.exe] Error 1169
jom: C:\Users\Cristiano\Documents\QtProjects\CCfits-test\Makefile [release] Error 2
18:05:38: The process "C:\Qt\Qt5.1.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project CCfits-test (kit: MSVC2008)
When executing step 'Make'

Added after 7 minutes:

The following is the build log from Visual Studio. Could you guess something more from that...

9693

Thanks in advance.




Creating temporary file "c:\Users\Cristiano\Downloads\cookbook\Release\RSP0 0000831204196.rsp" with contents
[
/O2 /Ob1 /I "C:\Users\Cristiano\Downloads" /I "C:\Users\Cristiano\Downloads\CCfits" /I "C:\CCfits" /I "C:\cfitsio" /D "WIN32" /D "NDEBUG" /D "_VC80_UPGRADE=0x0700" /D "_MBCS" /FD /EHsc /MD /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /c /Zi /TP /Zm500

.\cookbook.cxx
]
Creating command line "cl.exe @c:\Users\Cristiano\Downloads\cookbook\Release\RSP 00000831204196.rsp /nologo /errorReport:prompt"
Creating temporary file "c:\Users\Cristiano\Downloads\cookbook\Release\RSP0 0000931204196.rsp" with contents
[
/OUT:"Release/cookbook.exe" /INCREMENTAL:NO /LIBPATH:"C:\Users\Cristiano\Downloads\CCfits\vs.net\CCfits\ Release" /LIBPATH:"C:\CCfits\vs.net\CCfits\Release" /LIBPATH:"C:\Users\Cristiano\Downloads\CCfits" /MANIFEST /MANIFESTFILE:"Release\cookbook.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\Users\Cristiano\Downloads\cookbook\Release\cook book.pdb" /DYNAMICBASE:NO CCfits.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Release\cookbook.obj"
]
Creating command line "link.exe @c:\Users\Cristiano\Downloads\cookbook\Release\RSP 00000931204196.rsp /NOLOGO /ERRORREPORT:PROMPT"
Creating temporary file "c:\Users\Cristiano\Downloads\cookbook\Release\RSP0 0000A31204196.rsp" with contents
[
/outputresource:".\Release\cookbook.exe;#1" /manifest

.\Release\cookbook.exe.intermediate.manifest
]
Creating command line "mt.exe @c:\Users\Cristiano\Downloads\cookbook\Release\RSP 00000A31204196.rsp /nologo"
Creating temporary file "c:\Users\Cristiano\Downloads\cookbook\Release\BAT0 0000B31204196.bat" with contents
[
@echo Manifest resource last updated at %TIME% on %DATE% > .\Release\mt.dep
]
Creating command line "c:\Users\Cristiano\Downloads\cookbook\Release\BAT0 0000B31204196.bat"