Debugging Help

W

w84larisa

Has anybody downloaded the free Microsoft Visual C++ studio? If yes,
can some body tell me if it works?? I have a very short code (pasted
below) that compiles on my friend's computer but doesn't compile on
mine. I get the following errors:

Build started: Project: File Alpha, Configuration: Debug Win32 ------
Linking...
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol
_main referenced in function ___tmainCRTStartup
C:\Documents and Settings\Lara\My Documents\Visual Studio
2005\Projects\Invest Alpha\Debug\Invest Alpha.exe : fatal error
LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Lara\My
Documents\Visual Studio 2005\Projects\File Alpha\File
Alpha\Debug\BuildLog.htm"
File Alpha - 2 error(s), 0 warning(s)

Here is my code:
#include <iostream.h>;
/*Declaring a variable - matrix 4x10*/
float Start_Data[10][4] =
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
/*declaring a function that substracts the third column from the second
column*/
int Get_Range (Range)
{
int Range [10];
for (int i =0; i <=10; i++)
Range = Raw_Data [3] - Raw_Data [2];
return Range;
};

WHAT AM I MISSING?!?!
 
J

Jack Klein

Has anybody downloaded the free Microsoft Visual C++ studio? If yes,
can some body tell me if it works?? I have a very short code (pasted
below) that compiles on my friend's computer but doesn't compile on
mine. I get the following errors:

Build started: Project: File Alpha, Configuration: Debug Win32 ------
Linking...
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol
_main referenced in function ___tmainCRTStartup
C:\Documents and Settings\Lara\My Documents\Visual Studio
2005\Projects\Invest Alpha\Debug\Invest Alpha.exe : fatal error
LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Lara\My
Documents\Visual Studio 2005\Projects\File Alpha\File
Alpha\Debug\BuildLog.htm"
File Alpha - 2 error(s), 0 warning(s)

Here is my code:
#include <iostream.h>;
/*Declaring a variable - matrix 4x10*/
float Start_Data[10][4] =
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
/*declaring a function that substracts the third column from the second
column*/
int Get_Range (Range)
{
int Range [10];
for (int i =0; i <=10; i++)
Range = Raw_Data [3] - Raw_Data [2];
return Range;
};

WHAT AM I MISSING?!?!


A complete standard C++ program begins with a function named main()
that returns an int and accepts either no arguments, or two arguments
if you want to accept and process command line arguments. Your
program does not contain a main() function that meets these
requirements, so the linker is complaining that it can't find this
function, and therefore can't put together a complete program.

Try adding a main() function.
 
J

Jaspreet

Has anybody downloaded the free Microsoft Visual C++ studio? If yes,
can some body tell me if it works?? I have a very short code (pasted
below) that compiles on my friend's computer but doesn't compile on
mine. I get the following errors:

I guess the following code as it is **probably will not** compile.
Build started: Project: File Alpha, Configuration: Debug Win32 ------
Linking...
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol
_main referenced in function ___tmainCRTStartup
C:\Documents and Settings\Lara\My Documents\Visual Studio
2005\Projects\Invest Alpha\Debug\Invest Alpha.exe : fatal error
LNK1120: 1 unresolved externals

This complains about the fact that there is no main() function in your
code. You could have :

int main()
OR
int main(int argc, char **argv)
Build log was saved at "file://c:\Documents and Settings\Lara\My
Documents\Visual Studio 2005\Projects\File Alpha\File
Alpha\Debug\BuildLog.htm"
File Alpha - 2 error(s), 0 warning(s)

Here is my code:
#include <iostream.h>;

No need to have semicolons. I would prefer <iostream> against the
deprecated said:
/*Declaring a variable - matrix 4x10*/
float Start_Data[10][4] =
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
/*declaring a function that substracts the third column from the second
column*/
int Get_Range (Range)
What is range ? The parameters need a data type.

int Get_Range ( said:
{
int Range [10];

Redeclaration of Range.
for (int i =0; i <=10; i++)
Range = Raw_Data [3] - Raw_Data [2];


What is Raw_Data ?
return Range;
};

No need to have semicolons (;) after closing curly braces.
 
M

Marcus Kwok

Jaspreet said:
No need to have semicolons. I would prefer <iostream> against the
deprecated <iostream.h>

IIRC, this is a common misconception. <iostream.h> (and other C++-only
headers) are NOT deprecated but purely non-standard; their existence
came about before the standard, and many older compilers provided it.
AFAIK the newer versions of VS .NET do not even provide the old versions
anymore.
No need to have semicolons (;) after closing curly braces.

Unless you are declaring a struct or class.
 
P

Phlip

Marcus said:
IIRC, this is a common misconception. <iostream.h> (and other C++-only
headers) are NOT deprecated but purely non-standard; their existence
came about before the standard, and many older compilers provided it.
AFAIK the newer versions of VS .NET do not even provide the old versions
anymore.

Doesn't that mean they were deprecated (a real language-law term), and then
removed?

(Note that Herb Sutter makes such decisions for VC++ these days...)

Students of C++ need to be told two things:

- select modern tutorials that use <iostream>, not <iostream.h>

- to write the most portable possible code, you might find
yourself using <iostream.h>

If you don't need portable code, don't bother to wonder what happened to
<iostream.h>.
 
M

Marcus Kwok

Phlip said:
Doesn't that mean they were deprecated (a real language-law term), and then
removed?

Well, after doing more research:
http://www.comeaucomputing.com/techtalk/#cname
http://groups.google.com/group/comp.lang.c++/browse_frm/thread/c6a8286c4de9e66

they can be considered "implicitly deprecated", though in terms of the
Standard, they are not deprecated since they never existed. Many
compilers include them *as an extension* for compatibility with
pre-Standard implementations (paraphrased from the Comeau link). The
headers that have been explicitly deprecated by the Standard are the
(Note that Herb Sutter makes such decisions for VC++ these days...)

Students of C++ need to be told two things:

- select modern tutorials that use <iostream>, not <iostream.h>

Yes, good advice, though obviously that shouldn't be the only criteria
:)
- to write the most portable possible code, you might find
yourself using <iostream.h>

This one's a little tricky, since older compilers may need <iostream.h>
but newer ones may not even provide it, so you may need some sort of
mechanism to decide which one to #include.
If you don't need portable code, don't bother to wonder what happened to
<iostream.h>.

I need code that is portable to "modern" implementations :)
 
D

Default User

Phlip said:
Doesn't that mean they were deprecated (a real language-law term),
and then removed?

In which C++ standard were they declared to be deprecated?



Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top