Re: Seeting malloc pointer to NULL  -Totally confused!!!!!
I am using VC++ version 7.1, its quite an old version! And I have always
had problems creating .c files with it and that's why I always used .cpp
Well, whatever problems you might have using .c files, it would be a good
idea to fix those instead of eliding them and thus stepping into further
problems. The point is, you have implicitly told the compiler (and, by
convention any reader of your code) that you want to write code in C++. The
problem with that is that you are actually coding in C (or so it seems, I'm
afraid you yourself aren't too clear on that subject), but C and C++ are
very distinct languages, even though they look very similar!
I did create a project called xxx. Now in the solution explorer under
"source files" I have: xxx.cpp, assemblyInfo.cpp, stdafx.cpp... and I
created a new file called ccc.c and pasted my code in there. Compiled, got
error C1010: unexpected end of file while looking for precompiled header
Go to the project settings, deactivate support for precompiled headers.
Those won't be available on your MCU compiler anyway, they are not portable
and rather compiler-specific. Further, remove all C++ files from the
project. If you need their content, rename them to .c afterwards and then
add those again. This should also fix the issue that you are having two
using namespace System;
FYI, this construct is part of yet another language, I think it's C++/CLI.
This is definitely not available in standard C++ or C. If you didn't write
that, you selected the wrong project template when creating the VC project.
Chose a C/C++ commandline project without any files in it.
It would be a great help if one of you could copy the following code into
VC++ in a .c file and see what you get.
using namespace std;
<stdio.h> is a C header for various IO things. This header is available for
C++, too. <iostream> is a pure C++, as is using directive. Usually, you
don't want to use both of those in the same code. Again, I think you need
to work out the distinction between C and C++. You mention that your target
MCU has only 4k RAM, that means that you surely will not have a C++ stdlib
there, so I'd suggest you stay with C. Further, not everything that C
contains will also be available there, be ready for missing functionality.
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Gesch??ftsf??hrer: Thorsten F??cking, Amtsgericht Hamburg HR B62 932