Re: [Dev-C++] First experience with Dev-C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Joshua T. <vap...@ms...> - 2002-01-20 20:01:05
|
printf() function is a C antique, so its considered bad style so I used c=
out which conforms to ANSI standard...See notes at bottem for further com=
ments. Let me know if you need more help. =20
Joshua Thomas
// Try the code this way: =20
=20
#include <iostream>
#include <stdlib.h>
int main(char * argv =3D new char [1024], int argc)
{
cout << "Hello Dev-C++"; //displays text in quotes... << directs t=
he string to cout
=20
delete [] argv; //deletes array and pointer, so there is no memor=
y leak
=20
float wait =3D 0;
while (wait < 1E9) //see program notes
wait++;
=20
return 0;
}
// Program notes: while loop makes the computer count to 1 billion before=
closing the console window. This may or may =20
// not be enough time depending on your computer. You can use the ctime l=
ibrary to make the program more portable.
// (setting the program keep time in seconds not computer processing tick=
s through use of the while loop) Also note that =20
// stdio.h is not a valid library I believe you were looking for stdlib. =
Also your pointer syntax was off I fixed it and set the =20
// pointer argv to point to an array with the size of 1 MB of chars. (102=
4 variables in array of type char formally)
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello Dev-C++");
return 0;
}
//
Well; from command line: g++ b.cpp it compiles and create a.exe
correctly. But from Dev-C++ I have just this list of errors:
c:\mingw\bin\ld.exe: warning: cannot find entry symbol _mainCRTStartup;
defaulting to 00401000
c:\a2\b.o(.text+0x17)://c/a2/b.cpp: undefined reference to `__main'
c:\a2\b.o(.text+0x24)://c/a2/b.cpp: undefined reference to `printf'
What am I missing?
- I have installed MingW at c:\mingw
- Dev-C++ is configuraed this way:
- bin directory: c:\mingw\bin\
- C include files c:\mingw\include\
- C++ include files c:\mingw\include\
- Libraries directory c:\mingw\lib\
- OS: W2k
Thanks a lot!
--
Jilani Khaldi
http://space.tin.it/scuola/jkhaldi
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-usersGet more from t=
he Web. FREE MSN Explorer download : http://explorer.msn.com
|