473,221 Members | 1,786 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,221 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 2259
>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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.