Hello,
Long story short I was trying to download the windows mfc to go through a simple c++ game tutorial and came across win32++ as an alternative. I downloaded it, extracted it and tried to run the first tutorial but I didn't have the path to Wincore.h correct. I fixed that and now I get some errors.
My MinGW directory is D:\Codeblocks\MinGW and my win32++ directory is D:\Win32xx 720. Here is the tutorial code...
///////////////////////////////////////
// main.cpp
#include "D:/Win32xx 720/include/Wincore.h"
// Notes:
// 1) This application doesn't end when the window is closed
// 2) Add the Win32++\include directory to project's additional include directories
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
// Start Win32++
CWinApp MyApp;
// Create a CWnd object
CWnd MyWindow;
// Create (and display) the window
MyWindow.Create();
// Run the application
return MyApp.Run();
}
And here are the errors I receive when I try to build
D:\Win32xx 720\tutorials\Tutorial1\main.o:main.cpp:(.text$_ZN7Win32xx10CGDIObject7ReleaseEv[Win32xx::CGDIObject::Release()]+0x75)||undefined reference to `DeleteObject@4'|
)]+0x117)||undefined reference to `SaveDC@4'|
)]+0x119)||undefined reference to `SaveDC@4'|
D:\Win32xx 720\tutorials\Tutorial1\main.o:main.cpp:(.text$_ZN7Win32xx3CDC7DestroyEv[Win32xx::CDC::Destroy()]+0x4d)||undefined reference to `RestoreDC@8'|
D:\Win32xx 720\tutorials\Tutorial1\main.o:main.cpp:(.text$_ZN7Win32xx3CDC7DestroyEv[Win32xx::CDC::Destroy()]+0x91)||undefined reference to `DeleteDC@4'|
)]+0x1e4)||undefined reference to `GetStockObject@4'|
||=== Build finished: 6 errors, 0 warnings ===|
I assume I have some paths wrong, what should I do?
Thanks.
I do not know your level of skill with programming, but I found all of these wikibooks (http://en.wikibooks.org/wiki/Subject:C%2B%2B_programming_language) very useful for learning and polishing my C++.
If you do have the basics down (as learning C++ by starting with GUI programming is... difficult), wxWidgets is fairly straightforward to set up.
- Build wxWidgets (http://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW)
- Create a wxWidgets Code::Blocks project (http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef#Create_a_wxWidgets_project_in_Code::Blocks)
If you want to use win32++, I checked and they include example Code::Blocks projects (*.cbp) which build perfectly fine.
EDIT - I tried creating the whole thing as a project and got to the linker settings, but there are no libraries to add for win32++
Looking at the provided blank project template in win32++ reveals that the code needs to be linked with the following libraries:
comctl32
ole32
oleaut32
uuid
ws2_32
I suggest turning on full compiler logging and posting your request for how to program on a programming support site. Note: Please use Google before posting!
Here's what I get with full command line...
mingw32-g++.exe -ID:\wxWidgets-2.9.1\include -c D:\Things\Matts\My_Stuff\c++\win32\Untitled1.cpp -o D:\Things\Matts\My_Stuff\c++\win32\Untitled1.o
In file included from D:\wxWidgets-2.9.1\include/wx/chkconf.h:1122,
from D:\wxWidgets-2.9.1\include/wx/platform.h:711,
from D:\wxWidgets-2.9.1\include/wx/defs.h:26,
from D:\wxWidgets-2.9.1\include/wx/wx.h:15,
from D:\Things\Matts\My_Stuff\c++\win32\Untitled1.cpp:5:
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:20:10: error: #error "wxUSE_ACTIVEX must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:28:9: error: #error "wxUSE_CRASHREPORT must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:36:9: error: #error "wxUSE_DC_CACHEING must be defined"
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:60:10: error: #error "wxUSE_INICONF must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:68:10: error: #error "wxUSE_OLE must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:76:10: error: #error "wxUSE_OLE_AUTOMATION must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:84:9: error: #error "wxUSE_TASKBARICON_BALLOONS must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:92:10: error: #error "wxUSE_UNICODE_MSLU must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:100:10: error: #error "wxUSE_UXTHEME must be defined."
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:377:13: error: #error "wxUSE_DATAOBJ requires wxUSE_OLE"
D:\wxWidgets-2.9.1\include/wx/msw/chkconf.h:397:13: error: #error "wxMediaCtl requires wxActiveXContainer"
In file included from D:\wxWidgets-2.9.1\include/wx/platform.h:711,
from D:\wxWidgets-2.9.1\include/wx/defs.h:26,
from D:\wxWidgets-2.9.1\include/wx/wx.h:15,
from D:\Things\Matts\My_Stuff\c++\win32\Untitled1.cpp:5:
D:\wxWidgets-2.9.1\include/wx/chkconf.h:1515:13: error: #error "wxRearrangeCtrl requires wxCheckListBox"
Process terminated with status 1 (0 minutes, 12 seconds)
12 errors, 0 warnings
I have gone through many tutorials on C++, I started programming with GML so I am familiar with programming to an extent, I can write a simple c++ script that outputs in cmd but I have no use for that, I don't learn anything if I can't use any of it. I have googled for what feels like forever.
www.cprogramming.com is the site I use. All that being said I am still at a loss for how compilers and linkers work, so I guess this is the basis of my question. I don't know what a library is so I don't know what I'm doing.
If you do have the basics down (as learning C++ by starting with GUI programming is... difficult), wxWidgets is fairly straightforward to set up.
Build wxWidgets
Create a wxWidgets Code::Blocks project
I tried this out, I added to my enviroment variables and changed my cmd directory to build\msw but mingw32-make is unrecognised. How could it? mignw32 make is in my mingw folder not in my wxwidgets directory.
If you want to use win32++, I checked and they include example Code::Blocks projects (*.cbp) which build perfectly fine.
Quote from: MattJ812 on Today at 12:23:04 am
EDIT - I tried creating the whole thing as a project and got to the linker settings, but there are no libraries to add for win32++
Looking at the provided blank project template in win32++ reveals that the code needs to be linked with the following libraries:
Code:
comctl32
ole32
oleaut32
uuid
ws2_32
What are these libraries and how do I tell codeblocks what they are? I do not see them in any of the win32++ folders.
Sorry for all the questions, like I said I am familiar with programming to an extent I just still don't understand all this linking stuff.
Thanks.