473,385 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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!
Mar 5 '08 #1
3 2267
>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
Mar 5 '08 #2
On Mar 5, 3:40*pm, David Lowndes <Dav...@example.invalidwrote:
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
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
Mar 6 '08 #3
On Mar 5, 4:48 pm, NvrBst <nvr...@gmail.comwrote:
On Mar 5, 3:40 pm, David Lowndes <Dav...@example.invalidwrote:
>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

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
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
Mar 6 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Brian | last post by:
Greetings: I am trying to compile the following code via command line. It compiles just fine in visual studio 2002 v7 so i took looked at the properties and i got the following command line...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
3
by: Andrew Luke | last post by:
Hi all you C++ guru's! I'm 'very, very' new to C++ and I'm having a little trouble configuring my VS environment I think - when I try and compile some sample code I'm getting the following...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
3
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the...
3
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
My application is taking way too long to build. It use to never take so long. I change only line and I think it recompiles all the classes in the assembly because it hangs forever. Here is the...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
5
by: Zootal | last post by:
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...
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.