Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How to compile c code with vc++?
I have some c code that I would like to compile with visual studio, and
retain c compatibility. IOW, converting it to c++ is not an option. Is there
a way to configure the project to be compatible with c code? I can compile
the code just fine with gcc, so I believe the code is ok, but I get numerous
errors with visual studio. I'm using Visual Studio 2005



Report this thread to moderator Post Follow-up to this message
Old Post
Zootal
04-13-08 12:27 AM


Re: How to compile c code with vc++?
On Sat, 12 Apr 2008 11:56:38 -0700, "Zootal" <msnews@zootal.nospam.com>
wrote:

>I have some c code that I would like to compile with visual studio, and
>retain c compatibility. IOW, converting it to c++ is not an option. Is ther
e
>a way to configure the project to be compatible with c code? I can compile
>the code just fine with gcc, so I believe the code is ok, but I get numerou
s
>errors with visual studio. I'm using Visual Studio 2005

By default, files that end with the extension .c are compiled as C. You can
also force the issue with the /Tc and /TC compiler options (and vice versa
with /Tp and /TP).

--
Doug Harrison
Visual C++ MVP

Report this thread to moderator Post Follow-up to this message
Old Post
Doug Harrison [MVP]
04-13-08 12:27 AM


Re: How to compile c code with vc++?
"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
 news:5m2204l59gvoobfa5etpo9j88bmbqalk89@
4ax.com...
> On Sat, 12 Apr 2008 11:56:38 -0700, "Zootal" <msnews@zootal.nospam.com>
> wrote:
> 
>
> By default, files that end with the extension .c are compiled as C. You
> can
> also force the issue with the /Tc and /TC compiler options (and vice versa
> with /Tp and /TP).
>
> --
> Doug Harrison
> Visual C++ MVP

Thanks - I didn't know that. I'm finding there are issues with some of the
syntax, enough that I'm not sure it's worth the trouble to get it to work
with Visual Studio. It works with gcc, but I'm not sure if gcc has some
non-ansi c extensions that VS doesn't have <sigh>.



Report this thread to moderator Post Follow-up to this message
Old Post
Zootal
04-13-08 12:27 AM


Re: How to compile c code with vc++?
Zootal wrote:
> Thanks - I didn't know that. I'm finding there are issues with some of the
> syntax, enough that I'm not sure it's worth the trouble to get it to work
> with Visual Studio. It works with gcc, but I'm not sure if gcc has some
> non-ansi c extensions that VS doesn't have <sigh>.

Zootal:

The problem with some C code is that it is C99, which VC does not support (a
nd
last time I heard is not going to support).

For C++, in recent years I have found excellent compatibility between VC and
gcc, and it is very easy to produce code that will compile under either.

--
David Wilkinson
Visual C++ MVP

Report this thread to moderator Post Follow-up to this message
Old Post
David Wilkinson
04-13-08 12:27 AM


Re: How to compile c code with vc++?
"David Wilkinson" <no-reply@effisols.com> wrote in message
news:OEQTknNnIHA.1680@TK2MSFTNGP06.phx.gbl...
> Zootal wrote: 
>
> Zootal:
>
> The problem with some C code is that it is C99, which VC does not support
> (and last time I heard is not going to support).
>
> For C++, in recent years I have found excellent compatibility between VC
> and gcc, and it is very easy to produce code that will compile under
> either.
>
> --
> David Wilkinson
> Visual C++ MVP

Ahh...it's GNU C, and VS definitely is not 100% compatible. It's code that
emulates parts of the linux kernel, and some of the libraries it links in is
actual kernel code - that is the actual problem, not the code I'm working
with. <sigh>....debugging with gcc is a pain....




Report this thread to moderator Post Follow-up to this message
Old Post
Zootal
04-14-08 03:52 AM


Re: How to compile c code with vc++?
Zootal wrote:
> "David Wilkinson" <no-reply@effisols.com> wrote in message
> news:OEQTknNnIHA.1680@TK2MSFTNGP06.phx.gbl... 
>
> Ahh...it's GNU C, and VS definitely is not 100% compatible. It's code
> that emulates parts of the linux kernel, and some of the libraries it
> links in is actual kernel code - that is the actual problem, not the
> code I'm working with. <sigh>....debugging with gcc is a pain....

There is gcc for windows.  I don't think it generates debug information in
the Windows format though, so you may not get what you want.  Googling, I
see some suggestions that windbg supports the COFF format still but VS
dropped support at version 7, so you can probably get source level debugging
using windbg.



Report this thread to moderator Post Follow-up to this message
Old Post
Ben Voigt [C++ MVP]
04-16-08 12:50 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

VC++ archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:46 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.