From Luke.Hollenback at ballardtech.com Mon Oct 19 19:15:02 2015 From: Luke.Hollenback at ballardtech.com (Hollenback, Luke) Date: Tue Oct 20 10:23:00 2015 Subject: [xsde-users] Building VS2015 Project that uses XSDE Message-ID: Hey there, We are trying to use XSD/e for a Windows desktop project that may be expanded in the future to use more of the "embedded" features of the choice. Currently, I am simply trying to build the Hello World example in Visual Studio 2015 Community Edition on Debug. On Release, the same linker errors that I will show below happen, as well as a few more. I similarly have tried Visual Studio 2013 Community Edition with no success. I have access to a non-community edition version of the environment, but not on my current machine. I don't believe that is an issue, but correct me if I am wrong. Upon building the solution, which has all of the basic, pimpl, and pskel header and implementation files included in it, as well as the driver.cxx file, a mess of linker errors get spit out. You can check them out at this pastebin: http://pastebin.com/raw.php?i=tgRf6zxv. The C/C++ command line arguments listed in the project property page are: /GS /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /Fd"Release\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\VSProj.pch" Similarly, the linker command line arguments listed in the project property page are: /OUT:"D:\Working\XSDe Hello World\VSProj\Release\VSProj.exe" /MANIFEST /NXCOMPAT /PDB:"D:\Working\XSDe Hello World\VSProj\Release\VSProj.pdb" /DYNAMICBASE "xsde.lib" /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"D:\Working\XSDe Hello World\VSProj\Release\VSProj.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\VSProj.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"D:\XSDe\libxsde\xsde" /TLBID:2 The weirdest part is that I can build this Hello World project manually using CL and LINK. More specifically, by using the following commands from the developer command prompt (obviously with almost none of the arguments that Visual Studio is using): CL /ID:\XSDe\libxsde driver.cpp hello.cxx hello-pskel.cxx hello-pimpl.cxx LINK driver.obj hello.obj hello-pskel.obj hello-pimpl.obj D:\XSDe\libxsde\xsde\xsde.lib But I cannot, for example, use the LINK command with the .OBJ files generated by a Visual Studio build. We are hoping to be able to use XSD/e for this project because it, up until this point, has looked like the perfect answer to all of our needs. I'm sure that there is something simple that is being missed. Is there a particular switch that Visual Studio throws in the mix that is throwing everything off, potentially? I have read that XSD/e can be used in a desktop project no problem, which aligns with my intuition. I have also seen people talking about using it with Visual Studio-albeit, older versions than I am using. Please teach me how, or even if it is possible to, use XSD/e in a modern Visual Studio project. Thank you so much, I'm looking forward to hearing back, Luke This E-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return E-mail. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. From boris at codesynthesis.com Tue Oct 20 10:50:55 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 20 10:50:52 2015 Subject: [xsde-users] Building VS2015 Project that uses XSDE In-Reply-To: References: Message-ID: <20151020145055.GA17175@codesynthesis.com> Hi Luke, Hollenback, Luke writes: > Upon building the solution, which has all of the basic, pimpl, and pskel > header and implementation files included in it, as well as the driver.cxx > file, a mess of linker errors get spit out. Have you built the XSD/e runtime with the same VC++ runtime option as your project? Quoting from the INSTALL file, "Microsoft nmake" section: "If you are using an IDE (e.g., Visual Studio, eMbedded Visual C++, or Rational Rhapsody) to develop your applications, you can copy the compiler options (such as C++ language features, CPU and Platform preprocessor macros, etc.) from your project's C++ compiler settings. In particular, you need to make sure the CFLAGS and CXXFLAGS variables in config.nmake contain the same runtime option (one of /MD, /MDd, /ML, /MLd, /MT, /MTd) as your application. A common symptom of using different runtime options when building the XSD/e runtime library (xsde.lib) and your application is a large number of link errors related to undefined or redefined symbols." > The C/C++ command line arguments listed in the project property page are: > > /GS /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /Fd"Release\vc140.pdb" > /Zc:inline /fp:precise /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D > "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD > /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\VSProj.pch" So in your case it is /MD. Add it to CFLAGS/CXXFLAGS in config.nmake and rebuild the XSD/e runtime. You may also want to build and link different version of the XSD/e runtime for Debug and Release (though a release runtime built with /MD should work for debug builds). For example, make two copies of the original libxsde directory called, say, libxsd-release and libxsde-debug, and configure each accordingly. > Similarly, the linker command line arguments listed in the project > property page are: > > /OUT:"D:\Working\XSDe Hello World\VSProj\Release\VSProj.exe" /MANIFEST /NXCOMPAT > /PDB:"D:\Working\XSDe Hello World\VSProj\Release\VSProj.pdb" /DYNAMICBASE > "xsde.lib" /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"D:\Working\XSDe > Hello World\VSProj\Release\VSProj.pgd" /SUBSYSTEM:CONSOLE > /MANIFESTUAC:"level='asInvoker' uiAccess='false'" > /ManifestFile:"Release\VSProj.exe.intermediate.manifest" /OPT:ICF > /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"D:\XSDe\libxsde\xsde" /TLBID:2 I assume you have entered xsde.lib in the "Linker" -> "Input" -> "Additional Dependencies" field? This is important since in case of static libraries (which xsde.lib is), the position on the command line where theyr appear is significant. Boris