Error D8045 Cannot Compile C
Contents |
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV line app error Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation visual studio /tp APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested
Visual Studio Clr Option
has been removed. You’ll be auto redirected in 1 second. C/C++ Building Reference C/C++ Build Errors Command-Line Errors D8000 Through D9999 Command-Line Errors D8000 Through D9999 Command-Line Error D8045 Command-Line Error D8045 Command-Line Error D8045 Command-Line Error D8016 Command-Line Error D8021 Command-Line Error D8022 Command-Line Error D8027 Command-Line Error D8036 Command-Line Error D8037 Command-Line Error D8045 Command-Line Warning D9024 Command-Line Warning D9025 Command-Line Warning D9026 Command-Line Warning D9027 Command-Line Warning D9028 Command-Line Warning D9035 Command-Line Warning D9036 Command-Line Warning D9040 Command-Line Warning D9041 Command-Line Warning D9043 TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Command-Line Error D8045 Visual Studio 2015 Other Versions Visual Studio 2013 Visual Studio 2012 Visual Studio 2010 Visual Studio 2008 Visual Studio 2005 cannot compile C file 'file' with the /clr optionOnly C++ source code files can be passed to a compilation that uses /clr. Use /TP to compile a .c file as a .cpp file; see /Tc, /Tp, /TC, /TP (Specify Source File Type) for more information.For more information, see /clr (Common Language Runtime Compilation).D8045 can also occur if you compile an ATL application using Visual C++. See How to: Migrate to /clr for more information. Show: Inherited Protected Print Export (0)
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up D8045: cannot compile C file 'serialcommands.c' with the /clr option up vote 7 down vote favorite I am getting compiler https://msdn.microsoft.com/en-us/library/abb82cy0.aspx error D8045. cannot compile C file 'serialcommands.c' with the /clr option. This file is a C library that has been written to talk over a serial port to a TI processor. The task that I need to do is wrap this library with a CLR wrapper (there will be additional questions posted to stackoverflow concerning marshalling data back and forth if you want some more easy points from CLI questions.) I just want http://stackoverflow.com/questions/880413/d8045-cannot-compile-c-file-serialcommands-c-with-the-clr-option to use this C library from my CLR wrapper. I went to Properties->Configuration Properties->C/C++->General->Compile with Common Language runtime support = No Common Language Runtime support Is this the correct way to do this? Will I experience nasty weird bugs later or are other things that I need to do to use this? .net c++-cli clr share|improve this question edited Mar 9 '15 at 14:55 Deduplicator 27.9k63265 asked May 19 '09 at 0:20 MedicineMan 5,4402172117 as a follow up, I am now a year out from using this solution and never have experienced any problems as a result of using this solution. No "wierdness" as I feared. –MedicineMan May 18 '10 at 17:26 add a comment| 1 Answer 1 active oldest votes up vote 8 down vote accepted Yes. You need to compile any C objects without /CLR, since the clr only understands classes and objects. You can still use them from your C++/CLI project, wrapped inside of your "ref class" objects. This is a normal way of wrapping a C api in .NET objects. share|improve this answer answered May 19 '09 at 0:25 Reed Copsey 395k377921115 1 Note: This can be done "per file" not just per project, not sure that was clear from question/answer here on first reading. –user645280 Apr 7 '14 at
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings http://stackoverflow.com/questions/30329574/compile-c-code-with-clr-option and policies of this site About Us Learn more about Stack Overflow http://stackoverflow.com/questions/7668161/how-can-i-create-a-single-visual-studio-project-that-mixes-c-and-c-using-clr the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only visual studio takes a minute: Sign up Compile C code with /clr option up vote -1 down vote favorite I have library project that is compiled with /CLR option. Now I need to connect to WCF server using native CPP WCF client. During compilation I got error Error 1 error D8045: cannot compile C file 'schemas.microsoft.com.2003.10.Serialization.xsd.c' with the /clr option How to error d8045 cannot solve this problem? c++ visual-c++ share|improve this question asked May 19 '15 at 15:14 vico 2,63063471 1 Hmm, pretty unclear what you hope to accomplish with WCF from a C source file. Anyhoo, the /CLR option requires a C++ source file. A starting point is to force it to get compiled as C++, might just work. Right-click the file > Properties > C/C++ > Advanced > Compile As = Compile as C++ Code. –Hans Passant May 19 '15 at 15:24 Or just rename the file as .cpp, less confusing for you when you come back and see C++ syntax in a C file, or try to add it to another project. –Ben Voigt May 19 '15 at 15:33 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote Use the /TP flag to force the CLR compiler to treat it like a C++ file: https://msdn.microsoft.com/en-us/library/abb82cy0(VS.80).aspx share|improve this answer answered May 19 '15 at 15:25 Maurice Reeves 1,120720 add a comment| Your Answer draft saved draft discarded Sign up or log in Sig
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How can I create a single Visual Studio project that mixes C and C++ using CLR? up vote 4 down vote favorite I am working on porting code that builds on GCC on Unix to windows using Visual Studio 2008. I would like to create a single executable that does not depend on any dll(s) of my own creation and only built in ones to the Windows operating system. My code includes zlib which itself includes C files which I can build and link fine into my Unix executable. In my beginning attempts to build, the first error I hit is that the C code from zlib cannot be built with CLR since it is not C++. I see some suggesting to break this out into a separate DLL which would be linked into my executable but I'd like to avoid the complexity of shared libraries if possible. (Perhaps this avoidance is even more complex?) Is there a way to mix my C++ with the C code of zlib into a single executable with CLR? My current build error is the following: 1>cl : Command line error D8045 : cannot compile C file '..\src\zlib-1.2.5\zutil.c' with the /clr option c++ c visual-studio-2008 clr porting share|improve this question asked Oct 5 '11 at 21:48 WilliamKF 10.8k33108207 You cannot create a program with /clr compiled object files that do not have a dependency. Short from .NET having to be installed, you will also need to deploy the DLL version of the CRT. –Hans Passant Oct 5 '11 at 22:15 1 You might like to have a look here msdn.microsoft.com/en-us/library/x0w2664k. –alk Oct 6 '11 at 19:36 Also there does exist a win32 port for some zlib version: gnuwin32.sourceforge.net/packages/zlib.htm –alk Oct 6 '11 at 19:39 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted You could change it to cpp to get it compiled by the C++ compiler (an