Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
Showing results for 
Search instead for 
Did you mean: 

c versus cpp

Go to solution
Piotr Kirklewski
Super Advisor

c versus cpp

Hi there

I grabbed this source code from the internet - it has .c extension. Author says that it was created in Visual C++ but when I create a project (C++ console applicatiotn) in VC++ then it creates .cpp file, and if I paste the code then I've got some complaints from the compiler.

Any Idea what what to do with .c file in VC++ ?


Jesus is the King
Steven Schweda
Honored Contributor

Re: c versus cpp

You're asking in an HP-UX forum. Does Visual
C++ have anything to do with HP-UX?

> [...] I've got some complaints [...]

You're the only non-psychic who can see them.
If you find an appropriate forum, consider
the advantages of providing some useful
Piotr Kirklewski
Super Advisor

Re: c versus cpp

That was first nasty answer on HP forum since I became a member.
I wish they add an option to assign negative points :)
I think they should.
Jesus is the King

Re: c versus cpp

Despite this being posted in the wrong forum a reply can still be useful.

Many of the GUI based coding tools (especially the OO ones), generate background links, indexes, etc which the tools then use internally for their functionality. What is shown on the screen is sometimes just the visible part of the code base, this means that cutting and pasting snippets of code into the tool often just doesn't work. You can check this by cutting and pasting a HelloWorld program into a new, virgin project. Some tools are quite happy with this, others just won't recognise it

First run the code through a lint utility to see if there are any errors and how serious they are, there are then three alternative approaches you could try:-

- Try importing the code rather than pasting it into the editor.

- Try compiling the code (in another compiler) and run it as a called function. You would obviously have to define the parameters and return codes for errors.

- Generate the code in the GUI tool so that the tool does generate all the background stuff.

Finally, if you are going to be doing this a lot, you shuold probably use a different tool! There are GUI tools around that generate all their background stuff only from what is written in the code and not from processes invoked when writing it.
Piotr Kirklewski
Super Advisor

Re: c versus cpp

Thanks :)
Jesus is the King