Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2008

Tip: Looking for answers? Try searching our database.

Compile .c extensions as a C98++  using Visual Studio

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NvrBst - 05 Mar 2008 22:37 GMT
Right now I have C99 code in .c extensions.

I compile it in VSC++ and it complains about a lot of errors.
I change the extensions to .cpp and compile in VSC++ and it succeeds.

Is there a way to keep my extensions .c, but tell VSC++ (through an
project option) to compile as C++98 code (as if it had .cpp
extensions).

Thanks!
David Lowndes - 05 Mar 2008 23:40 GMT
>Is there a way to keep my extensions .c, but tell VSC++ (through an
>project option) to compile as C++98 code (as if it had .cpp
>extensions).

Have a look at the /TC and /TP options.

Dave
NvrBst - 06 Mar 2008 00:48 GMT
> >Is there a way to keep my extensions .c, but tell VSC++ (through an
> >project option) to compile as C++98 code (as if it had .cpp
[quoted text clipped - 3 lines]
>
> Dave

Opse sorry.  I forgot to mention I seen the "Project > Properties >
Configuration Properties > C/C++ > Advanced > Compile As" which has
the options:

Compile as C++ (/TP)
Compile as C Code (/TC)

The project is defaulted to /TP (no matter if the extention is .c
or .cpp).  Even with /TP set, if the file extentions are all .c it
wont compile.  Renaming the files (inside the solution explorer)
without changing any of the project properties (from .c to .cpp) makes
it compile.

As a result it doesn't look like this setting does anything for me
(and the extention on the files are what's dictating compile type).  I
was hoping for another property someplace (something like ignore file
extention) kinda thing; or another work-around; or maybe I'm just
using the "Compile As" incorrectly?

Thanks, NB
NvrBst - 06 Mar 2008 00:54 GMT
> > >Is there a way to keep my extensions .c, but tell VSC++ (through an
> > >project option) to compile as C++98 code (as if it had .cpp
[quoted text clipped - 24 lines]
>
> Thanks, NB

lol;

I just tried again...  When I import the .c files, the default is
indeed set to /TP... (C++), so I thought it was using it.

But then I changed it to /TC, and BACK to /TP.... then tried to
compile... and it works.

So maybe the individual files were set to /TC, and doing this then
sets them all to /TP  (even though the main project Properties were
always set to /TP).

Anyway thanks for the help... i did look at this option before, but re-
looking at it has solved my problem! thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.