By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

Which C tool?

P: n/a
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?

Thanks,

JB

Nov 1 '06 #1
Share this Question
Share on Google+
23 Replies


P: n/a
On 31 Oct 2006 17:17:07 -0800
jo***********@isfis.com wrote:
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give
me options to work in C++ but as I am dealing with embedded systems
and PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
I suggest programming with vim. Other people may prefer emacs. They are
both great editors and they should suit your needs.
Nov 1 '06 #2

P: n/a
On Tue, 31 Oct 2006 22:41:05 -0300
Rafael Almeida <ra*****@dcc.ufmg.brwrote:
On 31 Oct 2006 17:17:07 -0800
jo***********@isfis.com wrote:
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give
me options to work in C++ but as I am dealing with embedded systems
and PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C
programing tool?

I suggest programming with vim. Other people may prefer emacs. They
are both great editors and they should suit your needs.
It sounds like you're working in Windows. I'd suggest either GVim for
an editor or DevC++ if you're looking for an IDE.

==
Adam Shea
Nov 1 '06 #3

P: n/a
I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
You may need something specific to your device or PIC. E.g. MicroChip
has their own C compiler for their PIC line, and there are third party
compilers specific to certain devices as well.

Depending on what you're doing, you may be able to use Visual Studio -
files that end in .c (not .cc or .cpp) are by default compiled as C
code, or you can set file-by-file or project-by-project settings to
compile as C instead of as C++ (under C/C++ Advanced). To write stuff
for an embedded device, you may need to download extensions that
support WinCE, which can be found by googling.

Michael

Nov 1 '06 #4

P: n/a
On 31 Oct 2006 19:40:14 -0800, "Michael" <mc******@aol.comwrote in
comp.lang.c:
I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?

You may need something specific to your device or PIC. E.g. MicroChip
has their own C compiler for their PIC line, and there are third party
compilers specific to certain devices as well.

Depending on what you're doing, you may be able to use Visual Studio -
files that end in .c (not .cc or .cpp) are by default compiled as C
code, or you can set file-by-file or project-by-project settings to
compile as C instead of as C++ (under C/C++ Advanced). To write stuff
for an embedded device, you may need to download extensions that
support WinCE, which can be found by googling.

Michael
I am wiping tears from my eyes from laughing so hard, but I just had
to respond even though it's way off-topic...

The notion of the incredible resource hogging, bloated POS WinCE
running on a PIC!

Pull the other one.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 1 '06 #5

P: n/a

jo***********@isfis.com wrote:
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?

Thanks,

JB
I've been around the block a few times on editors and keep coming back
to Jen's File Editor
http://home.arcor.de/jensaltmann/JFE/jfe_eng.htm

Its buggy and kind of annoing at times. However I find it perfect for
big C projects with fairly flat directory structures. Beware, it loads
all text files into RAM, but this makes searching through files fast.
It also has a look/feel like Visual Studio.

Editplus is not bad either (google editplus). However its not freeware.

I'd honestly keep playing around with different editors until you found
one to your liking.

Nov 1 '06 #6

P: n/a
Thanks for the help, I'll have a look at the tools you mentioned. I
use tiny bootloader to work with pic 18f/16f devices and I suppose I
could write in notepad for all its worth but I've always been more
comfortable with IDEs.

Thanks,

JB

Nov 1 '06 #7

P: n/a
On 31 Oct 2006 17:17:07 -0800, jo***********@isfis.com wrote:
>I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.
You can, of course, write programs in C with Visual Studio 2005. The
Windows API is written in C.
>Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
- Create a console project
- Remove all generated files like "stdafx.h"
- Add your files with *.c extension

I've just compiled the following program in Visual Studio 2005 (note
it's C: no prototypes, no cast for malloc)

int main() {
char* c = malloc (100);
strcpy (c, "Hello, world!");
printf ("%s", c);
free (c);
}

//Compiler output: C_Test - 0 error(s), 5 warning(s)

If you just want an editor (not an IDE) on Windows take a look at the
great freeware PSPad: http://www.pspad.com/en/

Best wishes,
Roland Pibinger
Nov 1 '06 #8

P: n/a

Jack Klein wrote:
On 31 Oct 2006 19:40:14 -0800, "Michael" <mc******@aol.comwrote in
comp.lang.c:
I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.
>
Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
You may need something specific to your device or PIC. E.g. MicroChip
has their own C compiler for their PIC line, and there are third party
compilers specific to certain devices as well.

Depending on what you're doing, you may be able to use Visual Studio -
files that end in .c (not .cc or .cpp) are by default compiled as C
code, or you can set file-by-file or project-by-project settings to
compile as C instead of as C++ (under C/C++ Advanced). To write stuff
for an embedded device, you may need to download extensions that
support WinCE, which can be found by googling.

Michael

I am wiping tears from my eyes from laughing so hard, but I just had
to respond even though it's way off-topic...

The notion of the incredible resource hogging, bloated POS WinCE
running on a PIC!

Pull the other one.
No one ever said it had to run *well*.

Nov 1 '06 #9

P: n/a
Roland Pibinger wrote:
I've just compiled the following program in Visual Studio 2005 (note
it's C: no prototypes, no cast for malloc)
Prototypes are encouraged for C code. You really should use int
main(void), and also include <stdio.h>, <stdlib.hand <string.hto
provide prototypes for the functions you call.
int main() {
char* c = malloc (100);
strcpy (c, "Hello, world!");
printf ("%s", c);
free (c);
}

//Compiler output: C_Test - 0 error(s), 5 warning(s)
Here are the 5 diagnostics your code produces:

'malloc' undefined; assuming extern returning int
'initializing' : 'char *' differs in levels of indirection from 'int'
'strcpy' undefined; assuming extern returning int
'printf' undefined; assuming extern returning int
'free' undefined; assuming extern returning int

These are _real_ problems. They may not prevent the code from working on
your 32-bit system, but just wait until someone tries to run it on a
64-bit system where ints and pointers have a different size.

They can all be fixed by including the required header files.

--
Simon.
Nov 1 '06 #10

P: n/a
On 31 Oct 2006 17:17:07 -0800, jo***********@isfis.com wrote:
>Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
This group deals with the language as defined by the standard, not
with the compilers that process the code. Try the microsoft.public.vc
hierarchy for questions about using VS for C.
Remove del for email
Nov 1 '06 #11

P: n/a
On Thu, 02 Nov 2006 02:09:12 +1100, Simon Biber <ne**@ralmin.cc>
wrote:
>Here are the 5 diagnostics your code produces:

'malloc' undefined; assuming extern returning int
'initializing' : 'char *' differs in levels of indirection from 'int'
'strcpy' undefined; assuming extern returning int
'printf' undefined; assuming extern returning int
'free' undefined; assuming extern returning int

These are _real_ problems. They may not prevent the code from working on
your 32-bit system, but just wait until someone tries to run it on a
64-bit system where ints and pointers have a different size.
They can all be fixed by including the required header files.
That's understood. I just wanted to be sure that VS 2005 compiled the
program as C program, not as C++ program. Therefore I needed program
that was valid in C but not in C++.

Best regards,
Roland Pibinger
Nov 1 '06 #12

P: n/a
jo***********@isfis.com wrote:
>
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
Well, ignoring the "what is the best" part of the question...

VS2005 should handle C programs just fine. (Unless Microsoft really
screwed everyone over by removing that possibility.) Just don't use
any of the "wizards", and start with an "empty project". Then add
your C source (with ".c" extensions) to the project. At least this
is how earlier versions of Visual Studio did it.

If this doesn't work, or you need further help, you'll need to ask in
one of the Microsoft- or Windows-specific newsgroups.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Nov 1 '06 #13

P: n/a
Roland Pibinger wrote:
On Thu, 02 Nov 2006 02:09:12 +1100, Simon Biber <ne**@ralmin.cc>
wrote:
>Here are the 5 diagnostics your code produces:

'malloc' undefined; assuming extern returning int
'initializing' : 'char *' differs in levels of indirection from 'int'
'strcpy' undefined; assuming extern returning int
'printf' undefined; assuming extern returning int
'free' undefined; assuming extern returning int

These are _real_ problems. They may not prevent the code from working on
your 32-bit system, but just wait until someone tries to run it on a
64-bit system where ints and pointers have a different size.
They can all be fixed by including the required header files.

That's understood. I just wanted to be sure that VS 2005 compiled the
program as C program, not as C++ program. Therefore I needed program
that was valid in C but not in C++.
Based on those warnings I don't think the program is valid C either. The
C standard explicitly allows compilers to compile invalid programs even
where it requires that the compiler produce some kind of diagnostic
message, where a diagnostic message could be as unhelpful as, "I think
you stink."

If you wand a program that is valid C but invalid C++ here are a few
simple examples

int main(void)
{
int new;
return 0;
}

int main(void)
{
int i;
void *p = &i;
return 0;
}

int main(void)
{
int class;
return 0;
}

You may get warnings about unused variables, but all of the above are
strictly conforming C programs but any C++ compiler is required to
produce a diagnostic for every one of them. Of course, if the C++
standard is anything like the C standard the compiler could just
generate a warning but compile the code anyway.
--
Flash Gordon
Nov 1 '06 #14

P: n/a
Flash Gordon wrote:
If you wand a program that is valid C but invalid C++ here are a few
simple examples
[...]
int main(void)
{
int i;
void *p = &i;
return 0;
}
This is both valid C and valid C++. The conversions in the opposite
direction are the ones that are disallowed in C++.

Nov 1 '06 #15

P: n/a
Flash Gordon <sp**@flash-gordon.me.ukwrites:
[...]
If you wand a program that is valid C but invalid C++ here are a few
simple examples

int main(void)
{
int new;
return 0;
}
[snip]

Or if you want the program to tell you at run time:

#include <stdio.h>
int main(void)
{
if (sizeof(int) == 1) {
printf("Can't tell\n");
}
else if (sizeof 'x' == sizeof(int)) {
printf("This is C\n");
}
else if (sizeof 'x' == 1) {
printf("This is C++\n");
}
else {
printf("Compiler bug?\n");
}
return 0;
}

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 1 '06 #16

P: n/a
Harald van Dijk wrote:
Flash Gordon wrote:
>If you wand a program that is valid C but invalid C++ here are a few
simple examples
[...]
>int main(void)
{
int i;
void *p = &i;
return 0;
}

This is both valid C and valid C++. The conversions in the opposite
direction are the ones that are disallowed in C++.
Well, 2 out of 3 ain't bad.
--
Flash Gordon
Nov 1 '06 #17

P: n/a
Roland Pibinger wrote:
>
.... snip ...
>
That's understood. I just wanted to be sure that VS 2005 compiled
the program as C program, not as C++ program. Therefore I needed
program that was valid in C but not in C++.
#include <stdio.h>
int main(void) {
char class[24];
const char *new = "I am a C compiler";

strcpy(class, new);
puts(new);
return 0;
}

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Nov 1 '06 #18

P: n/a
On Wed, 01 Nov 2006 16:57:06 -0500, CBFalconer <cb********@yahoo.com>
wrote:
>Roland Pibinger wrote:
>>
... snip ...
>>
That's understood. I just wanted to be sure that VS 2005 compiled
the program as C program, not as C++ program. Therefore I needed
program that was valid in C but not in C++.

#include <stdio.h>
int main(void) {
char class[24];
const char *new = "I am a C compiler";

strcpy(class, new);
puts(new);
return 0;
}
warning C4013: 'strcpy' undefined; assuming extern returning int

I think you need to include <string.h>. In VS 2005, or VS 6 for that
matter, just double-click on "strcpy" and press F1 to get the best
help on the planet. Thanks Microsoft.

--
jay
Nov 2 '06 #19

P: n/a
jaysome said:

<snip>
>
warning C4013: 'strcpy' undefined; assuming extern returning int

I think you need to include <string.h>.
Correct.
In VS 2005, or VS 6 for that
matter, just double-click on "strcpy" and press F1 to get the best
help on the planet.
<coughNo comment.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Nov 2 '06 #20

P: n/a
jaysome wrote:
CBFalconer <cb********@yahoo.comwrote:
>Roland Pibinger wrote:
>>>
... snip ...
>>>
That's understood. I just wanted to be sure that VS 2005 compiled
the program as C program, not as C++ program. Therefore I needed
program that was valid in C but not in C++.

#include <stdio.h>
int main(void) {
char class[24];
const char *new = "I am a C compiler";

strcpy(class, new);
puts(new);
return 0;
}

warning C4013: 'strcpy' undefined; assuming extern returning int

I think you need to include <string.h>. ... snip ...
You are correct.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

Nov 2 '06 #21

P: n/a
John Bode wrote:
Jack Klein wrote:
>On 31 Oct 2006 19:40:14 -0800, "Michael" <mc******@aol.comwrote in
comp.lang.c:
>>>I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?
You may need something specific to your device or PIC. E.g. MicroChip
has their own C compiler for their PIC line, and there are third party
compilers specific to certain devices as well.

Depending on what you're doing, you may be able to use Visual Studio -
files that end in .c (not .cc or .cpp) are by default compiled as C
code, or you can set file-by-file or project-by-project settings to
compile as C instead of as C++ (under C/C++ Advanced). To write stuff
for an embedded device, you may need to download extensions that
support WinCE, which can be found by googling.

Michael
I am wiping tears from my eyes from laughing so hard, but I just had
to respond even though it's way off-topic...

The notion of the incredible resource hogging, bloated POS WinCE
running on a PIC!

Pull the other one.

No one ever said it had to run *well*.
On a PIC? Not at all.
Nov 3 '06 #22

P: n/a
jo***********@isfis.com wrote:
Hi

I have a copy of Visual Studio 2005 and Borland Delphi but I'm at a
loss to find where I can start to code C applications, they all give me
options to work in C++ but as I am dealing with embedded systems and
PIC devices I can't use it.

Does anyone know if I can get Visual Studio, I think its better than
Borland, to work with C or failing that what is the best C programing
tool?

Thanks,

JB
To write C for a PIC you Need a cross-compiler
Hi-Tech C, CSS or microchipC
details at microchipC.com

For visual Studio .C files are treated as C.
Delphi is a different language.
Nov 3 '06 #23

P: n/a
Simon Biber wrote:
Roland Pibinger wrote:
I've just compiled the following program in Visual Studio 2005 (note
it's C: no prototypes, no cast for malloc)

Prototypes are encouraged for C code. You really should use int
main(void), and also include <stdio.h>, <stdlib.hand <string.hto
provide prototypes for the functions you call.
I think the poster was trying to show VS2005 was compiling the code
as C and not C++ (ie the code would not compile without errors if
the C++ compiler was in fact doing the compiling).

Jussi Jumppanen
Author: Zeus for Windows IDE - http://www.zeusedit.com

Nov 5 '06 #24

This discussion thread is closed

Replies have been disabled for this discussion.