Go Back   Computer Forums > General Computing > Programming
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 04-14-2006, 01:57 AM   #1
Beta Member
Join Date: Mar 2006
Posts: 2
Exclamation C++ Compiler Reads C Source Codes

Hello everyone.

I am an amateur of both C++ and C programs. So, I need help.

So far, what I've heard from cprogramming.com

is that "You should note that if you are programming in C on a C++ compiler, then you will want to make sure that your compiler attempts to compile C instead of C++ to avoid small compatability issues in later tutorials."

So, i'm wondering,

1) What specific problems would there be if C++ compiler tends to read C programming codes?

Anyway, the important thing is:

2) Can I continue doing my work permanently with C++ compiler for C programming codes instead of using C compiler?

I currently have Microsoft Visual C++ in hand. If this is possible, then I don't have to get another C compiler for my C program files.

Details from you people are much appreciated. Thank you in advance for helping out.

eddykk is offline   Reply With Quote
Old 04-15-2006, 09:40 AM   #2
Beta Member
Join Date: Mar 2006
Posts: 2
Unhappy Re: C++ Compiler Reads C Source Codes

Woah. Where are you people? Where's your spirit of helping people in need? Why is there no reply? Is it because of my annoying green-colour text formatting? There, I've changed it to default.

Anyway, I've the answer to my problem from another different forum.

But, the thing is, now I've another different problem.

Take a look, here's what I got from the other forum (BOLD) and my reply to it (ITALIC):

If you name your C files using a .c file extension, then, by default, VC++ will compile them in "C mode" and not in "C++ mode."

An alternative is to set a compiler setting inside of your project settings so that it will force ANSI C.

If you really want to know more about the problems that "C" programs can have when being compiled with a C++ compiler, you can use the MSDN to take a look at "__declspec" to see what it says in the help files.

If you just want to avoid those problems, it is probably better to name your files using a .c file extension and check your project settings for ANSI compatibility. In other words, yes, you can use your VC++ compiler.


Thanks for replying, davis.

But I've another problem.

Does MSVC++ have a bulit-in program of GNUPlot?

I'm trying to make a C program that produces a graph of a projectile motion. And I require a GNUPlot.

As far as I know GNUPlot is another different seperated-portable command-line driven interactive data and function plotting utility.


1) Does MSVC++ have a bulit-in program of GNUPlot?

2) How to integrate GNUPlot with MSVC++?

3) To make a graph of projectile motion, isn't it necessary for me to write codes in MSVC++ and at the same time working with GNUPlot in another window?

4) How does this entire thing work in both different working-environment (MSVC++ and GNUPlot) ?

Please help. Thanks.

eddykk is offline   Reply With Quote
Old 04-15-2006, 01:35 PM   #3
Site Team
root's Avatar
Join Date: Mar 2004
Posts: 7,872
Default Re: C++ Compiler Reads C Source Codes

1), No, msvc does not have gnu plot

gnu plot is completly seperate, you can use GNU plot to draw graphs, but you'll have to download it and setup the project to work with the settnigs to make it work, (that makes very little sense I know)...

2) you can find out about GNU plot here.

Documentation on the project can be found here (http://gnuplot.sourceforge.net/docs_4.1/).

but as far as integratnig it into VC++ I've not tried so I can't realy help, in fact this is really the first time I've even thought of using GNU plot, as in past projects I've used GD objects to draw graphs and saved then as Jpgs. -though give me a few months and I might have decided that GNU plot is the next best thing snice sliced bread,

3), I really couldn't tell you, but I miagine that you'll out the equations in the program, the program will figure out the points to plot, pas that on to GNU plot, and the plotting will take place in a seperate window, (that's how it'd usually be done) (I think)

(does anyone know if it can plot interactive refreshing graphs in realtmie?).

For different working enviornments, I don't think so, (though I may not have grasped the question.)
if you write ANSI C it will compile on any C compiler, any machine, the bianry can then be run on any simillar machine,

so simple hello worlds compiled on windows can run on any wnidows machine, cmopiled on mac can run on any mac etc.

the problem is that yuo'll e introducnig outside binary files and pre-compiled libraries to your project for the GNUplot part, so you'l need the GNUplot libraries that you use on all the machines you intend to run on.
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 12:14 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0