Compiling dcm2xml as a Single Project on W2K with MC++6
Moderator: Moderator Team
Compiling dcm2xml as a Single Project on W2K with MC++6
I have successfully compiled the ALL_BUILD set of projects within DCMTK using MC++6, but now want just to build dcm2xml as a separate project. Even with all necessary header files added to a new project for this purpose, there a number of link errors that occur.
I notice that, within the DCMTK downloaded source code, dcm2xml has 2 shortcuts to files appearing between the Source Code and External Dependencies folders in the file view for this project. They are dcmdata and ofstd. Can someone tell me how to insert these shortcuts (to directories, it seems) into my new project. My assumption is that these might solve the link errors I'm getting.
Thanks very much,
dave
I notice that, within the DCMTK downloaded source code, dcm2xml has 2 shortcuts to files appearing between the Source Code and External Dependencies folders in the file view for this project. They are dcmdata and ofstd. Can someone tell me how to insert these shortcuts (to directories, it seems) into my new project. My assumption is that these might solve the link errors I'm getting.
Thanks very much,
dave
-
- DCMTK Developer
- Posts: 117
- Joined: Tue, 2004-11-02, 17:21
- Location: Oldenburg, Germany
- Contact:
What you call a "shortcut to directories" is actually a "dependency": dcm2xml makes use of functions in dcmdata and ofstd, hence it is dependent on dcmdata and ofstd. When dcmdata and ofstd are compiled, the compiler result are the two libraries (containing machine executable code) dcmdata.lib and ofstd.lib. Since dcm2xml makes use of code in ofstd and dcmdata, it has to link against these two libraries. And that is exactly what you have to tell the compiler. In order to do so, make the following changes:
1. make sure "dcm2xml" is your active project (printed in bold letters) in MSVC6
2. go "Projects" -> "Dependencies" (a small window opens)
3. select "dcm2xml" in the combobox in the upper left corner of the window (this should actually already be selected)
4. in the list box in the lower left corner of the window, select/pick dcmdata and ofstd.
5. go "OK"
6. re-compile
It should work now.
1. make sure "dcm2xml" is your active project (printed in bold letters) in MSVC6
2. go "Projects" -> "Dependencies" (a small window opens)
3. select "dcm2xml" in the combobox in the upper left corner of the window (this should actually already be selected)
4. in the list box in the lower left corner of the window, select/pick dcmdata and ofstd.
5. go "OK"
6. re-compile
It should work now.
Thanks for your reply, Thomas. I followed your example and was able to add dcmdata and ofstd as subprojects and dependencies to dcm2xml. However, now I get these errors:
Compiling...
dcm2xml.cpp
Linking...
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _WSACleanup@0
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _gethostbyname@4
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _gethostname@8
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _WSAStartup@8
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _Netbios@4
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateInit2_
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateInit_
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateEnd
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflate
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflateInit2_
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflateEnd
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflate
Debug/Dicom2XML.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.
Dicom2XML.exe - 18 error(s), 1 warning(s)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Likely my environment is still not set up correctly.
Open to suggestions.
Thanks,
dave
Compiling...
dcm2xml.cpp
Linking...
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LIBCMTD.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already defined in LIBCD.lib(osfinfo.obj)
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _WSACleanup@0
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _gethostbyname@4
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _gethostname@8
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _WSAStartup@8
dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol _Netbios@4
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateInit2_
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateInit_
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflateEnd
dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol _inflate
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflateInit2_
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflateEnd
dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol _deflate
Debug/Dicom2XML.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.
Dicom2XML.exe - 18 error(s), 1 warning(s)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Likely my environment is still not set up correctly.
Open to suggestions.
Thanks,
dave
-
- DCMTK Developer
- Posts: 117
- Joined: Tue, 2004-11-02, 17:21
- Location: Oldenburg, Germany
- Contact:
almost there... Damn Hurricane Rita!
dependencies dcmdata and ofstd compile and link ok.
--------------------Configuration: Dicom2XML - Win32 Release--------------------
Linking...
Start Pass1
LINK : warning LNK4001: no object files specified; libraries used
Searching Libraries
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
Searching .\dcmdata\libsrc\Release\dcmdata.lib:
Searching .\ofstd\libsrc\Release\ofstd.lib:
Done Searching Libraries
End Pass1
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
Release/Dicom2XML.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Dicom2XML.exe - 2 error(s), 1 warning(s)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Googled "_mainCRTStartup", says 'main' can't be found.
Confused now...
dave
dependencies dcmdata and ofstd compile and link ok.
--------------------Configuration: Dicom2XML - Win32 Release--------------------
Linking...
Start Pass1
LINK : warning LNK4001: no object files specified; libraries used
Searching Libraries
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
Searching .\dcmdata\libsrc\Release\dcmdata.lib:
Searching .\ofstd\libsrc\Release\ofstd.lib:
Done Searching Libraries
End Pass1
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
Release/Dicom2XML.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Dicom2XML.exe - 2 error(s), 1 warning(s)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Googled "_mainCRTStartup", says 'main' can't be found.
Confused now...
dave
-
- DCMTK Developer
- Posts: 117
- Joined: Tue, 2004-11-02, 17:21
- Location: Oldenburg, Germany
- Contact:
Make sure the file which contains your main()-routine is included in the project you are compiling. The linker error at the top indicates that you dont even have one file contained in the project you are compiling, if that is really the case, let me tell you that this does not make any sense.
I assume you know what the main()-routine is about, dont you?
I assume you know what the main()-routine is about, dont you?
-
- DCMTK Developer
- Posts: 117
- Joined: Tue, 2004-11-02, 17:21
- Location: Oldenburg, Germany
- Contact:
Thanks for all the suggestions, Thomas. I'm not sure exactly what I've done to get this error, but dcm2xml.cxx has certainly been inserted into the project.
I think that I will start again from the beginning, making use of your input.
I'll post back when I get a chance to work on this again.
Thanks very much,
dave
I think that I will start again from the beginning, making use of your input.
I'll post back when I get a chance to work on this again.
Thanks very much,
dave
Who is online
Users browsing this forum: No registered users and 1 guest