alittle progaming help

The place to hang out and talk about totally anything general.
the white raven
level1
level1
Posts: 11
Joined: Wed Aug 30, 2006 8:58 pm
Location: not quite sure

alittle progaming help

Postby the white raven » Sun Nov 12, 2006 12:21 pm

i am having trouble trying to compile this code on my borland c++ compiler v5.5 the code is


#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>

int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
MessageBox(NULL, "What's up world!",
"My First Windows Program",MB_OK);

return(0);
}

does anyone have any ideas the code trys to create a windows box that say's what's up world
when i compiled this code it came up with all of this warning stuff like
warning W8057 prog3_2.cpp 19: Parameter 'hinstance' is never used in function __stdcall WinMain<HINSTANCE__*,HINSTANCE__*,char *,int>

and also
Error nresolved external '_main' refenced from C:\BORLAND\BCC55\LIB\C0X32.OBJ

any idea's :?:
User avatar
wwarnick
level5
level5
Posts: 1863
Joined: Mon Oct 02, 2006 8:44 pm
Location: Rexburg, ID

Postby wwarnick » Tue Nov 14, 2006 2:02 am

Try googling it. It seems every programming problem has been addressed somewhere on the internet.
I didn't know Borland was still making compilers (or is that an old one?). I haven't used C++ in so long, it's nostalgic. But I'm 100% C# now. If you're new to programming, I'd try something a little easier than C++, like Visual Basic. Get Visual Studio Express from Microsoft.com. I don't know how many features it has since I use Pro, but it should do the job.

wwarnick
the white raven
level1
level1
Posts: 11
Joined: Wed Aug 30, 2006 8:58 pm
Location: not quite sure

Postby the white raven » Tue Dec 05, 2006 4:41 pm

ive found out the problem i was compiling it wrong it turns out i was compiling it as a command line program but i needed to compile it as a windows program
hello
Pod
level1
level1
Posts: 28
Joined: Fri Feb 15, 2002 4:59 pm

Postby Pod » Tue Dec 05, 2006 6:14 pm

all commandline programs needs a main() function - as yours didn't have one it couldn't find it :)
User avatar
wwarnick
level5
level5
Posts: 1863
Joined: Mon Oct 02, 2006 8:44 pm
Location: Rexburg, ID

Re: alittle progaming help

Postby wwarnick » Tue Dec 05, 2006 9:55 pm

the white raven wrote:int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow)

This is his main function. When programming Windows GUI apps in C++, the main function looks like this.

wwarnick
prozachar
level1
level1
Posts: 60
Joined: Fri Oct 06, 2006 8:57 pm

Re: alittle progaming help

Postby prozachar » Tue Dec 05, 2006 11:20 pm

the white raven wrote:
warning W8057 prog3_2.cpp 19: Parameter 'hinstance' is never used in function __stdcall WinMain<HINSTANCE__*,HINSTANCE__*,char *,int>


Warnings about unused parameters can usually be safely ignored. In functions that you define, you should probably consider removing the parameter from the function if you get this warning. However, it's generally a good idea to leave those 4 parameters into WinMain, just like it's a good idea to always do

Code: Select all

int main(int argc, char** argv)

for command line programs, even if you don't need to read command line parameters.


And if you take the time to learn C++ well as your first language, you'll be well prepared to learn other languages.
User avatar
wwarnick
level5
level5
Posts: 1863
Joined: Mon Oct 02, 2006 8:44 pm
Location: Rexburg, ID

Re: alittle progaming help

Postby wwarnick » Wed Dec 06, 2006 2:15 am

prozachar wrote:And if you take the time to learn C++ well as your first language, you'll be well prepared to learn other languages.

True. After C++, every other language is downhill in my opinion. I personally, however, would (and did) start with something easier.

wwarnick
User avatar
NeoThermic
Introversion Staff
Introversion Staff
Posts: 6256
Joined: Sat Mar 02, 2002 10:55 am
Location: ::1
Contact:

Re: alittle progaming help

Postby NeoThermic » Wed Dec 06, 2006 3:22 am

wwarnick wrote:
prozachar wrote:And if you take the time to learn C++ well as your first language, you'll be well prepared to learn other languages.

True. After C++, every other language is downhill in my opinion.


Nah, ASM is the next logical step after you master C++. It allows you to do things that C++ takes longer to do (or any other language, for that matter). ;)

NeoThermic
User avatar
wwarnick
level5
level5
Posts: 1863
Joined: Mon Oct 02, 2006 8:44 pm
Location: Rexburg, ID

Postby wwarnick » Wed Dec 06, 2006 8:24 pm

Efficient, but easier?

wwarnick
User avatar
NeoThermic
Introversion Staff
Introversion Staff
Posts: 6256
Joined: Sat Mar 02, 2002 10:55 am
Location: ::1
Contact:

Postby NeoThermic » Wed Dec 06, 2006 8:29 pm

wwarnick wrote:Efficient, but easier?

wwarnick


Depends on how you #define easier

</bad programming jokes>

NeoThermic
User avatar
wwarnick
level5
level5
Posts: 1863
Joined: Mon Oct 02, 2006 8:44 pm
Location: Rexburg, ID

Postby wwarnick » Wed Dec 06, 2006 8:50 pm

#undef NeoThermic's bad programming jokes

wwarnick
User avatar
NeoThermic
Introversion Staff
Introversion Staff
Posts: 6256
Joined: Sat Mar 02, 2002 10:55 am
Location: ::1
Contact:

Postby NeoThermic » Wed Dec 06, 2006 8:56 pm

wwarnick wrote:#undef NeoThermic's bad programming jokes

wwarnick


delete wwarnick;

NeoThermic
Montyphy
level5
level5
Posts: 6747
Joined: Tue Apr 19, 2005 2:28 pm
Location: Bristol, England

Postby Montyphy » Wed Dec 06, 2006 8:59 pm

NeoThermic wrote:
wwarnick wrote:#undef NeoThermic's bad programming jokes

wwarnick


delete wwarnick;


If only you really did... ;)
Uplink help: Check out the Guide or FAQ.
Latest Uplink patch is v1.55.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Wed Dec 06, 2006 9:33 pm

Montyphy wrote:
NeoThermic wrote:
wwarnick wrote:#undef NeoThermic's bad programming jokes

wwarnick


delete wwarnick;


If only you really did... ;)

Only after a few other people that I could mention...

xander

Return to “Introversion Lounge”

Who is online

Users browsing this forum: No registered users and 37 guests