Opendwg compilation problems

Source: Internet
Author: User

Compile with Visual C ++ 2005 Express?
Compile with Visual C ++ 2005 Express?
Is it possible to compile and link using ms visual c ++ 2005 express edition? I have a small utility that I need to port from Linux to Windows. I downloaded the express program, SP1, and Windows Platform SDK, but I'm not having much luck. the examples will generally compile, but linking is a problem. typical errors look like this:
Code:
Exhostappservices. OBJ: Error lnk2019: unresolved external symbol _ imp _ regenumvaluew @ 32 referenced in function "public: Virtual bool _ thiscall exhostappservices: classes (class odttfdescriptor const &, class odstring &)"(? Ttffilenamebydescriptor @ exhostappservices @ uae_nabvodttfdescriptor @ aavodstring @ Z)
Dd_vc8md_gi.lib (odtruetypefont. OBJ): Error lnk2001: unresolved external symbol _ imp _ regenumvaluew @ 32
Exhostappservices. OBJ: Error lnk2019: unresolved external symbol _ imp _ regclosekey @ 4 referenced in function "public: Virtual bool _ thiscall exhostappservices: classes (class odttfdescriptor const &, class odstring &)"(? Ttffilenamebydescriptor @ exhostappservices @ uae_nabvodttfdescriptor @ aavodstring @ Z)
Dd_vc8md_gi.lib (odtruetypefont. OBJ): Error lnk2001: unresolved external symbol _ imp _ regclosekey @ 4
Thanks,
Mark
Add "advapi32.lib" to the libraries list.
Vladimir
Do you mean the setting for Options> VC ++ directories?
If so, then C:/program files/Microsoft platform SDK/lib is already listed there and advapi32.dll is in that directory.
Now that I study it some more, I think I cocould use some help setting up the VC ++ directories. Currently I have the following references to ODA files:
Library files:
D:/ODA/lib/vc8mt
D:/ODA/lib/vc8md
Shocould I also put the debug directories in there? Do I need to list the EXE directory or the include directory anywhere? What is the difference between the MT and MD? Obviusly, I'm not familiar with the Windows interface. If you can help me get configured so the examples will build, I'll be able to learn more as I go along.
Thanks very much,
Mark

You can either add the Lib directly in the project settings, or in code you can:
Code:
# Pragma comment (Lib, 'advapi32. lib') // requires registry API functions
In your code.
Personally, I set the folders for the libs in the project settings, but I use Pragma's in code to know which Libs I require.
Fair warning, I believe they are MS/Windows specific, so if you intended to make cross platform compilable code you wowould either # define them out or have them in the Project Settings...
As far...
Code:
Library files:
D:/ODA/lib/vc8mt
D:/ODA/lib/vc8md
You shoshould only have one directory in there, dependent on your project settings ..
What I have done, again as windows specific is ..
Code:
//////////////////////////////////////// ////////////////////////////////////
// For cleaner/easier code, we turn some warnings into errors. All of these
// Errors can be avoided by properly written code
//////////////////////////////////////// ////////////////////////////////////
// Disable warnings caused by STL
# Pragma warning (Disable: 4786) // identifier was truncated to 'number' characters in the debug information
// Convert certain deadly warnings to errors
# Pragma warning (error: 4002) // too parameter actual parameters for macro 'identifier'
# Pragma warning (error: 4003) // not enough actual parameters for macro 'identifier'
# Pragma warning (error: 4004) // incorrect construction after 'defined'
# Pragma warning (error: 4006) // # UNDEF expected an identifier
# Pragma warning (error: 4009) // string too big; Trailing characters truncated
# Pragma warning (error: 4015) // 'identifier': type of bit field must be integral
# Pragma warning (error: 4033) // 'function' must return a value
# Pragma warning (error: 4035) // 'function': No Return Value
# Pragma warning (error: 4045) // 'identifier': Array Bounds Overflow
# Pragma warning (error: 4053) // One void operand '? :'
# Pragma warning (error: 4054) // 'Conversion': From function pointer 'type1' to Data Pointer 'type2'
# Pragma warning (error: 4059) // Pascal string too big, Length byte is length % 256
# Pragma warning (error: 4063) // case 'identifier' is not a valid value for switch of Enum 'identifier'
# Pragma warning (error: 4064) // switch of incomplete Enum 'identifier'
# Pragma warning (error: 4078) // case constant 'value' too big for the type of the switch expression
# Pragma warning (error: 4087) // 'function': declared with 'void' parameter list
# Pragma warning (error: 4098) // 'function': void function returning a value
# Pragma warning (error: 4390) // ';': Empty controlled statement found; is this the intent?
# Pragma warning (error: 4541) // rtti train wreck
# Pragma warning (error: 4706) // assignment in conditional
# Pragma warning (error: 4715) // not all control paths return a value
# Pragma warning (error: 4013) // function undefined; Assuming extern returning int
# Pragma warning (error: 4553) // '=': operator has no effect; did you intend '= '?
# Pragma warning (error: 4551) // function call Missing argument list
//////////////////////////////////////// ////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////
// Macros for emitting compiler messages
//////////////////////////////////////// ////////////////////////////////////
// Debugging trick, outputs to do messages during compile time
// One can double click the output to jump to the source line
# Ifndef _ todo __
# DEFINE _ str2 _ (x) # x
# DEFINE _ str1 _ (x) _ str2 _ (x)
# DEFINE _ todo _ file _ "(" _ str1 _ (_ line _) "): to do :"
# Endif
// Another message
# Ifndef _ compile_option __
# DEFINE _ str2 _ (x) # x
# DEFINE _ str1 _ (x) _ str2 _ (x)
# DEFINE _ compile_option _ file _ "(" _ str1 _ (_ line _) "): Compile option :"
# Endif
// Another message
# Ifndef _ quirk __
# DEFINE _ str2 _ (x) # x
# DEFINE _ str1 _ (x) _ str2 _ (x)
# DEFINE _ quirk _ file _ "(" _ str1 _ (_ line _) "): quirk :"
# Endif
//////////////////////////////////////// ////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////
// Macro to determine which Runtime is being used. Useful for only having
// To do a single # ifdef compare for each lib we link
//////////////////////////////////////// ////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////
# If defined (_ Debug) & defined (_ MT) & defined (_ DLL) // msvcrtd,/MDD
# Define msvcrtd // debug Dynamic Link (DLL)
# Pragma message (_ compile_option _ "Debug Dynamic Link (DLL )")
# Elif defined (_ Debug) & defined (_ MT) // libcmtd,/MTD
# Define libcmtd // debug static multithread
# Pragma message (_ compile_option _ "Debug static multithread ")
# Elif defined (_ MT) & defined (_ DLL) // msvcrt,/MD
# Define msvcrt // Dynamic Link (DLL)
# Pragma message (_ compile_option _ "Dynamic Link (DLL )")
# Elif defined (_ MT) // libcmt,/mt
# Define libcmt // static multithread
# Pragma message (_ compile_option _ "static multithread ")
# Else
# Pragma warning ("not using/mt,/MTD,/MD, or/MDD! ")
# Endif
In a common header... and then in my code I can do ..
Code:
# If! Defined (_ toolkit_in_dll _)
# If defined (msvcrtd) | defined (msvcrt) // MDD |/MD
// # Pragma comment (linker, "-verbose ")
# Pragma comment (Lib, "dd_vc8md_br") // depend of exploding Geometry
# If! Defined (use_custom_new_delete)
// # Pragma comment (Lib, "dd_vc8md_alloc.lib") // don't need this, as we have our own stubs
// # Pragma comment (Lib, "dd_alloc_dll.lib") // don't need this, as we have our own stubs
# Endif
# Pragma comment (Lib, "dd_vc8md_gi.lib ")
# Pragma comment (Lib, "dd_vc8md_acisrenderer.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_vc8md_acisbuilder.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_vc8md_modelergeometry.lib") // for exploding Geometry
# Pragma comment (Lib, "dd_vc8md_db.lib ")
# Pragma comment (Lib, "dd_vc8md_ge.lib ")
# Pragma comment (Lib, "dd_vc8md_gs.lib ")
# Pragma comment (Lib, "dd_vc8md_plotsettingsvalidator.lib ")
# Pragma comment (Lib, "dd_vc8md_root.lib ")
# Pragma comment (Lib, "dd_vc8md_spatialindex.lib ")
# Pragma comment (Lib, "dd_vc8md_recomputedimblock.lib ")
# Elif defined (libcmtd) | defined (libcmt) // MTD |/mt
// Mt option!
# Pragma comment (Lib, "dd_vc8mt_br") // depend of exploding Geometry
# If! Defined (use_custom_new_delete)
// # Pragma comment (Lib, "dd_vc8mt_alloc.lib") // don't need this, as we have our own stubs
// # Pragma comment (Lib, "dd_alloc_dll.lib") // don't need this, as we have our own stubs
# Endif
# Pragma comment (Lib, "dd_vc8mt_gi.lib ")
# Pragma comment (Lib, "dd_vc8mt_acisrenderer.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_vc8mt_acisbuilder.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_vc8mt_modelergeometry.lib") // for exploding Geometry
# Pragma comment (Lib, "dd_vc8mt_db.lib ")
# Pragma comment (Lib, "dd_vc8mt_ge.lib ")
# Pragma comment (Lib, "dd_vc8mt_gs.lib ")
# Pragma comment (Lib, "dd_vc8mt_plotsettingsvalidator.lib ")
# Pragma comment (Lib, "dd_vc8mt_root.lib ")
# Pragma comment (Lib, "dd_vc8mt_spatialindex.lib ")
# Pragma comment (Lib, "dd_vc8mt_recomputedimblock.lib ")
# Else
# Pragma error ("_ MD [d] Or _ mT [d] must be defined! ")
# Endif
# Else
// If we want opendesign to be external DLL's
# Pragma comment (Lib, "dd_br_dll") // depend of exploding Geometry
# If! Defined (use_custom_new_delete)
# Pragma comment (Lib, "dd_alloc_dll.lib") // don't need this, as we have our own stubs
// # Pragma comment (Lib, "dd_alloc_dll.lib") // don't need this, as we have our own stubs
# Endif
# Pragma comment (Lib, "dd_gi_dll.lib ")
# Pragma comment (Lib, "dd_acisrenderer_dll.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_acisbuilder_dll.lib") // depend of exploding Geometry
# Pragma comment (Lib, "dd_modelergeometry_dll.lib") // for exploding Geometry
# Pragma comment (Lib, "dd_db_dll.lib ")
# Pragma comment (Lib, "dd_ge_dll.lib ")
# Pragma comment (Lib, "dd_gs_dll.lib ")
# Pragma comment (Lib, "dd_plotsettingsvalidator_dll.lib ")
# Pragma comment (Lib, "dd_root_dll.lib ")
# Pragma comment (Lib, "dd_spatialindex_dll.lib ")
// # Pragma comment (Lib, "dd_vc8md_rxrasterservices.lib ")
// # Pragma comment (Lib, "dd_vc8md_rxrasterprocessor.lib ")
# Pragma comment (Lib, "dd_vc8md_recomputedimblock.lib ")
// # Pragma comment (Lib, "dd_vc8md_dummyrecomputedimblock.lib ")
// Dd_vc8mt_recomputedimblock.lib
// # Pragma comment (Lib, "gs_winbitmap.lib ")
// # Pragma comment (Lib, "dd_vc8md_ave.lib ")-
// # Pragma comment (Lib, "dd_vc8md_exfieldevaluator.lib ")
# Endif
Then all you need to worry about is having the appropriate lib path per project configuration.
You may (and, perhaps, shocould) Use ready project files for compiling examples.
Then, having a working example, you may fix your project accordingly.
Static MD configuration:/projectfiles/Win32/msvc8/allexamples. sln.
DLL configuration:/projectfiles/Win32/msvc8/allexamplesdll. sln.
MD/MT differ in the C Runtime usage (dynamc vs. Static runtime)
(Using # pragma (LIB), as suggested above, is... questionable)
Vladimir
So I edited the VC ++ directories so there is a reference to vc8mt but not vc8md. then I loaded the allexamples. SLN and tried to build odreadex from there. but I still have the Link errors:
Code:
------ Rebuild all started: Project: odreadex, configuration: Release Win32 ------
Deleting intermediate and output files for project 'odreadex ', configuration 'release | Win32'
Compiling...
Tostring. cpp
Odfilebuf. cpp
Exundocontroller. cpp
Exsystemservices. cpp
Exhostappservices. cpp
Exgirasterimage. cpp
Generating code...
Compiling...
Odreadex. cpp
Compiling password support for R18 drawings
Giworlddrawdumper. cpp
Exprotocolextension. cpp
Dbdumper. cpp
Generating code...
Linking...
Creating library .. /.. /.. /.. /.. /EXE/vc8/release/odreadex. lib and object .. /.. /.. /.. /.. /EXE/vc8/release/odreadex. exp
Exhostappservices. OBJ: Error lnk2019: unresolved external symbol _ imp _ regenumvaluew @ 32 referenced in function "public: Virtual bool _ thiscall exhostappservices: classes (class odttfdescriptor const &, class odstring &)"(? Ttffilenamebydescriptor @ exhostappservices @ uae_nabvodttfdescriptor @ aavodstring @ Z)
Dd_vc8md_gi.lib (odtruetypefont. OBJ): Error lnk2001: unresolved external symbol _ imp _ regenumvaluew @ 32
Exhostappservices. OBJ: Error lnk2019: unresolved external symbol _ imp _ regclosekey @ 4 referenced in function "public: Virtual bool _ thiscall exhostappservices: classes (class odttfdescriptor const &, class odstring &)"(? Ttffilenamebydescriptor @ exhostappservices @ uae_nabvodttfdescriptor @ aavodstring @ Z)
Dd_vc8md_gi.lib (odtruetypefont. OBJ): Error lnk2001: unresolved external symbol _ imp _ regclosekey @ 4
Exhostap etc
I get similar results if I build the entire allexamples.
Mark
That's queer. Anyway, add the library advapi32.lib to the libraries list:
"Project Properties"> linker> additional dependencies
Vladimir
That improved things a lot! Now there are only 3 remaining unresolved externals:
Code:
------ Rebuild all started: Project: odreadex, configuration: Debug Win32 ------
Deleting intermediate and output files for project 'odreadex ', configuration 'debug | Win32'
Compiling...
Tostring. cpp
Odreadex. cpp
Compiling password support for R18 drawings
Giworlddrawdumper. cpp
Exprotocolextension. cpp
Dbdumper. cpp
Odfilebuf. cpp
Exundocontroller. cpp
Exsystemservices. cpp
Exhostappservices. cpp
Exgirasterimage. cpp
Generating code...
Linking...
Creating library .. /.. /.. /.. /.. /EXE/vc8/debug/odreadex. lib and object .. /.. /.. /.. /.. /EXE/vc8/debug/odreadex. exp
Dd_vc8md_root.lib (rxinit. OBJ): Error lnk2019: unresolved external symbol _ imp _ cotaskmemfree @ 4 referenced in function "public: Virtual class odstring _ thiscall odrxsystemservices: createguid (void )"(? Createguid @ odrxsystemservices @ UAE? Avodstring @ xz)
Dd_vc8md_root.lib (rxinit. OBJ): Error lnk2019: unresolved external symbol _ imp _ stringfromclsid @ 8 referenced in function "public: Virtual class odstring _ thiscall odrxsystemservices: createguid (void )"(? Createguid @ odrxsystemservices @ UAE? Avodstring @ xz)
Dd_vc8md_root.lib (rxinit. OBJ): Error lnk2019: unresolved external symbol _ imp _ cocreateguid @ 4 referenced in function "public: Virtual class odstring _ thiscall odrxsystemservices: createguid (void )"(? Createguid @ odrxsystemservices @ UAE? Avodstring @ xz)
..././EXE/vc8/debug/odreadex.exe: Fatal error lnk1120: 3 unresolved externals
Creating browse information file...
Microsoft browse information maintenance utility version 8.00.50727
Copyright (c) Microsoft Corporation. All rights reserved.
Build log was saved at "file: // D:/ODA/out/vc8/odreadex_debug/buildlog.htm"
Odreadex-4 error (s), 0 warning (s)
========= Rebuild all: 0 succeeded, 1 failed, 0 skipped ==========
Thanks again,
Mark
Add also ole32.lib
Vladimir
Success!
Thank you very much!
Mark

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.