User forums > Help
Fresh Win 32 GUI project will not compile
Mr_Poletski:
I've searched on here and not found my issue and this is annoying the hell out of me.
I've been an int main void man for ages, now I am trying to evolve into an int winmain void man now.
I have an application I want to adapt from, basically a dos app into a windows app with proper dialogues etc, rather than one I have to put files in the right place, pull the level and my program do it's business.
So I get code blocks, Create a brand new project 'win32 gui project'. Wonder what I am starting with, hit compile and get this:
--- Code: ---mingw32-g++.exe -Wall -O2 -Wall -g -DUNICODE -c "C:\Documents and Settings\my_login\My Documents\C\WinTruBack\main.cpp" -o obj\Release\main.o
C:\Documents and Settings\my_login\My Documents\C\WinTruBack\main.cpp: In function 'int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)':
C:\Documents and Settings\my_login\My Documents\C\WinTruBack\main.cpp:20:27: error: cannot convert 'char [21]' to 'LPCWSTR {aka const wchar_t*}' in assignment
C:\Documents and Settings\my_login\My Documents\C\WinTruBack\main.cpp:53:12: error: cannot convert 'char*' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings (0 minutes, 0 seconds)
--- End code ---
I find it hard to believe the default program template wont even compile. I fully expect it to run and then do sod all, but I can't even run it. I must be doing something wrong right? I just got 12.11, but it was doing the same thing for me on 10.5
MortenMacFly:
This is not a general programming forum. Please respect the forum rules you agreed to when registering, if you forgot, read the rules again here:
http://forums.codeblocks.org/index.php/topic,9996.0.html
Topic locked.
MortenMacFly:
--- Quote from: Mr_Poletski on December 19, 2012, 08:37:08 am ---But I was not asking for general programming help.
--- End quote ---
Well it is... in the end. The default projects are provided for convenience and only a starter. But they are not guaranteed to work as they (for example) heavily depend on the compiler you use which is out of our control. The project you use was designed for the VC compiler to my knowledge. It seems you are using GCC right?
I would recommend try at the command line first, or simply replace the code with the one of other resources and probably change the project setup accordingly. Why do you insist on using WinMain at all? I fail to see a reason to do so.
Edit: Unlocked again so you don't send me PM's, please.
Biplab:
@Morten,
This is a Bug in Win32 project wizard. Wizard generated code is good for Ansi build only. However OP is trying to build a Unicode version which will eventually fail. I will fix it tomorrow.
@Mr_Poletski ,
File a bug report in Berlios.
Jenna:
On XP the default project works fine without modifications using TDM gcc 4.7 as compiler.
Can it try to use unicode without modifications?
Navigation
[0] Message Index
[#] Next page
Go to full version