Error D8045 Cannot Compile
Contents |
SQL Server 2014 Express 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 and reference Dev centers Retired content Samples We’re sorry. The content you requested has been line app error removed. You’ll be auto redirected in 1 second. Ask a question Quick access Forums home
Visual Studio /tp
Browse forums users FAQ Search related threads Remove From My Forums Answered by: How to compile C using Visual C++? Archived Forums visual studio clr option V > Visual C++ Express Edition Question 0 Sign in to vote Is that possible at all? If it is, what are the steps to compile a C program in Visual C++? When I start up a new project, what kind of project I should pick? Many thanks! Monday, September 18, 2006 6:05 PM Answers 0 Sign in to vote Take a look at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=454672&SiteID=1 Thanks, Ayman Shoukry VC++ Team Monday, September 18, 2006 6:14 PM 0 Sign in to vote Try creating a simple console application and don't ask for .NET support. Monday, September 18, 2006 8:42 PM All replies 0 Sign in to vote Take a look at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=454672&SiteID=1 Thanks, Ayman Shoukry VC++ Team Monday, September 18, 2006 6:14 PM 0 Sign in to vote Thanks Ayman! I changed the compile option to compile the file as /TC, however, when I built the project, I still got the following error: cl : Command line error D8045 : cannot compile C file '.\Stdafx.cpp' with the /clr option Is there something else I will need to change besides the compile option at Properties? Thanks! Monday, September 18, 2006 6:43 PM 0 Sign in to vote Try creating a simple console application and don't ask for .NET support. Monday, September 18, 2006 8:42 PM 0 Sign in to vote hii get the following error ' Command line error D8045 : cannot compile C file'.I cant find any solutions.Can somebody help.ThanksAnil Thursday, October 12, 2006 1:36 PM 0 Sign in to vote the solution can be found at:http://msdn2.microsoft.com/en-us/library/k8d11d4s.aspx Sunday, March 18, 2007 1:09 AM 0 Sign in to vote Hi.......... Yes..You can compile your c programms in visual c++. 1. Open Microsoft Visual Studio 2005. Go to File Menu click New->Project. 2. Select Visual c++ and select win32 console application from the template menu. 3. Give File name with .c extention then press ok. (ex:- helloworld.c). Wednesday, March 21, 2007 9:14 AM 1 Sign in to vote on Visual studio 2008 go on Project -> properties -> C/C++ ->
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 error https://social.msdn.microsoft.com/Forums/en-US/b1bd7f93-2b5a-45f7-895c-9eda446f92ff/how-to-compile-c-using-visual-c?forum=Vsexpressvc 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 to http://stackoverflow.com/questions/880413/d8045-cannot-compile-c-file-serialcommands-c-with-the-clr-option 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 19:09 add
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 http://stackoverflow.com/questions/6062101/how-to-compile-c-code-in-visual-c-express-2010 this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/30329574/compile-c-code-with-clr-option 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 visual studio How to compile c code in visual c++ express 2010 up vote 4 down vote favorite 2 I am trying to compile c code in VS C++ express 2010 but I get the following error trace: 1>------ Build started: Project: test4, Configuration: Release Win32 ------ 1>cl : Command line error D8045: cannot compile C file 'test4.c' with the /clr option ========== Build: 0 error d8045 cannot succeeded, 1 failed, 0 up-to-date, 0 skipped ========== When I try and compile with cpp extension I get this error trace: 1>------ Build started: Project: test4, Configuration: Release Win32 ------ 1> test4.cpp 1>c:\documents and settings\rkelly1\desktop\io\test4\test4\pt_ioctl.c(86): error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\rkelly1\desktop\io\test4\test4\pt_ioctl.c(98): error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\rkelly1\desktop\io\test4\test4\pt_ioctl.c(138): error C2664: 'OpenServiceW' : cannot convert parameter 2 from 'const char [9]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\rkelly1\desktop\io\test4\test4\pt_ioctl.c(196): error C2664: 'GetSystemDirectoryW' : cannot convert parameter 1 from 'CHAR [80]' to 'LPWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\rkelly1\desktop\io\test4\test4\pt_ioctl.c(203): error C2664: 'lstrcatW' : cannot convert parameter 1 from 'CHAR [80]' to 'LPWSTR' 1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1>c:\documents and settings\rkelly1\desktop\io\test4
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 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 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 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 compiler for C++2MS VC++ 6 command line compile gets error RC1015: cannot open include file 'afxres.h'473Why is this program erroneously rejected by three C++ compilers?6LoadLibrary fails with error code 140010Strange error when compiling with vc++ 20120how to