Error D8045 Cannot Compile C File With The /clr Option
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 line app error Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev
Visual Studio Clr Option
centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto visual studio /tp redirected in 1 second. Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: How to compile C using Visual C++? Archived Forums 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 do
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 D8045. cannot https://social.msdn.microsoft.com/Forums/en-US/b1bd7f93-2b5a-45f7-895c-9eda446f92ff/how-to-compile-c-using-visual-c?forum=Vsexpressvc 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 use this C http://stackoverflow.com/questions/880413/d8045-cannot-compile-c-file-serialcommands-c-with-the-clr-option 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 a comment| Your Answer draft save
here for a quick overview of the site Help Center Detailed answers to any http://stackoverflow.com/questions/6062101/how-to-compile-c-code-in-visual-c-express-2010 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 visual studio a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up 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 error d8045 cannot 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 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-st