Error D8045 Cannot Compile C File
Contents |
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs
Line App Error
and reference Dev centers Retired content Samples We’re sorry. The content visual studio /tp you requested has been removed. You’ll be auto redirected in 1 second. C/C++ Building Reference C/C++ Build Errors visual studio clr option 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) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! We appreciate your feedback. Dev centers Windows Office Visual Studio Microsoft Azure More... Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter
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 Compiling C to use the CLR [duplicate] up vote 3 down vote favorite Possible Duplicate: Compiling C https://msdn.microsoft.com/en-us/library/abb82cy0.aspx code for .NET I have a bunch of C source code and I want to compile it so it uses the .NET framework. I downloaded Microsoft Visual C++ and chose new CLR project. I then added all my C code, and I tried to compile the files. It said cl : Command line error D8045: cannot compile C file '..\..\..\..\..\Downloads\lzma912\C\XzDec.c' with the /clr option Why can't I compile this? .net c share|improve http://stackoverflow.com/questions/3651959/compiling-c-to-use-the-clr this question edited Sep 6 '10 at 14:12 Joe Gauterin 10.8k2555 asked Sep 6 '10 at 13:48 Leo Izen 2,14351949 marked as duplicate by cHao, Jason, Joe Gauterin, George Stocker♦, Hans Olsson Sep 7 '10 at 20:20 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. 3 Why are you so aggressive ? –Cedric H. Sep 6 '10 at 14:03 4 IMHO, it is rude to close a question as "exactly duplicate" of a question that itself was closed as "not a real question"! –RBerteig Sep 6 '10 at 21:45 4 +1 to offset the downvoting. This is a reasonable question, in spite of the pre-emptive ranting by the OP. Given the way some folk dump on anything from MS without thinking, I'm sympathetic. But honestly, just editing the rant out was enough, it really didn't deserve a block of down votes as well. –RBerteig Sep 6 '10 at 21:50 add a comment| 2 Answers 2 active oldest votes up vote 14 down vote accepted Sometimes, looking to MSDN can clarify the things. You need to force the compiler to treat C files as C++ files. See here. To quote: Only C++ source co
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 http://stackoverflow.com/questions/30329574/compile-c-code-with-clr-option 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 Compile C code with /clr option up vote -1 down vote favorite I have library project that is compiled with /CLR option. Now visual studio 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 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. error d8045 cannot 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 Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged c++ visual-c++ or ask your own question. asked 1 year ago viewed 146 times active 1 year ago Related 1Why does this pointer to C++ function code generate a compile error?9getting the right c