News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

I feel stupid but... (SOLVED)

Started by Satch, January 24, 2006, 02:52:51 AM

Previous topic - Next topic

Satch

First of all say HI!!!  :)

This is a question that makes me feel stupid since it is one of those asked trillion times and answered trillion times, but I failed to find that answer in the forums with the search tool above.

I'm using code::blocks with MSVC2003 toolkit and MSDK. To be sure all would work fine from start I  followed the MSVC toolkit integration tutorial to set up lib and include paths properly.

I tested the settings with a simple console project (yes, default compiler MSVC2003) and no problems compiling neither linking.
When I replaced the "main" identifier with "winmain" the problem shown up:

"error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup"

it's clear that it is a missing library, but can't figure out which one since the MSDK libraries paths are all correct (checked like 10 times).

Any help would be welcome and I beg your pardon if there's already a post about this issue elsewhere in the forums.

Thx in advance :)

sethjackson

Quote from: Satch on January 24, 2006, 02:52:51 AM
First of all say HI!!!  :)

This is a question that makes me feel stupid since it is one of those asked trillion times and answered trillion times, but I failed to find that answer in the forums with the search tool above.

I'm using code::blocks with MSVC2003 toolkit and MSDK. To be sure all would work fine from start I  followed the MSVC toolkit integration tutorial to set up lib and include paths properly.

I tested the settings with a simple console project (yes, default compiler MSVC2003) and no problems compiling neither linking.
When I replaced the "main" identifier with "winmain" the problem shown up:

"error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup"

it's clear that it is a missing library, but can't figure out which one since the MSDK libraries paths are all correct (checked like 10 times).

Any help would be welcome and I beg your pardon if there's already a post about this issue elsewhere in the forums.

Thx in advance :)

Ok what version of C::B RC2, SVN-HEAD? Could you post some code and the libs you are linking in? You did include windows.h right...  :lol:

EDIT:

There is a template for Windows GUI programs too.  :wink:

takeshimiya

You need to change the "subsystem".

Menu Project->Properties->Targets tab.

In Select build target options->Type: change from "Console application" to "GUI application".

But anyways, I wonder why you want to use WinMain as the entry point. Are you programming with MFC?

sethjackson

Quote from: Takeshi Miya on January 24, 2006, 03:29:09 AM
You need to change the "subsystem".

Menu Project->Properties->Targets tab.

In Select build target options->Type: change from "Console application" to "GUI application".

But anyways, I wonder why you want to use WinMain as the entry point. Are you programming with MFC?

Uhh WinMain is for Win32 API programming....... Not MFC (AFAIK)......

takeshimiya

Quote from: sethjackson on January 24, 2006, 03:31:20 AM
Uhh WinMain is for Win32 API programming....... Not MFC (AFAIK)......

It is used, but internally, AFAIK.

sethjackson

Quote from: Takeshi Miya on January 24, 2006, 03:45:19 AM
Quote from: sethjackson on January 24, 2006, 03:31:20 AM
Uhh WinMain is for Win32 API programming....... Not MFC (AFAIK)......

It is used, but internally, AFAIK.

Ah I see.

Michael

#6
AFAIK WinMain is used by Win32 API (independent of using MFC or not). Win32 API is a C API. MFC wraps portions of the Windows API in C++ classes. Normal C/C++ programs use main, but windows programs use WinMain.

Michael

[EDIT] A link about the Windows API for all the fans of Windows :D.
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]

Satch

Thx for the tips :)

I forgot about the templates... guess I was too tired when I posted the issue.
The problem was a bad declaration of winmain. Guess I've been using BCB for too long and I forgot the basics  :lol: :lol: :lol: :lol:

I must ask you for your forgiveness to take room in this forum for such stupid question  :(

Thx again for your help.

Michael

Quote from: Satch on January 24, 2006, 10:42:30 AM
I must ask you for your forgiveness to take room in this forum for such stupid question  :(

IMHO there is no stupid question :D.

Michael
[url="http://img207.imageshack.us/img207/9728/411948picture4em.png"]http://img207.imageshack.us/img207/9728/411948picture4em.png[/url]