Author Topic: Win32++ errors  (Read 11760 times)

Offline MattJ812

  • Single posting newcomer
  • *
  • Posts: 5
Win32++ errors
« on: October 09, 2011, 11:40:13 pm »
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...

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


Code
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Win32++ errors
« Reply #1 on: October 09, 2011, 11:50:42 pm »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Win32++ errors
« Reply #2 on: October 10, 2011, 12:15:07 am »
And:
3. My build fails with multiple undefined reference errors

BTW: why don't you try something a bit more modern like wxWidgets or QT? Win32 and MFC are vastly outdated!
I second that.

Offline MattJ812

  • Single posting newcomer
  • *
  • Posts: 5
Re: Win32++ errors
« Reply #3 on: October 10, 2011, 12:23:04 am »
OK so I downloaded wxwidgets and copied and pasted the hello world tutorial into a codeblocks script.  I do not have a directories tab in global compiler settings, only search directories.  I put the directory for the wx.h file in both compiler and linker tabs.  My first error is wx.wx.h: No such file or directory.

I could type that into the include line like I did before but how do I tell codeblocks in general where those files are?

I also tried adding the directories for win32 in there but I still got the same errors.

EDIT - I am putting these codes in an empty file, build options under the project menu is greyed out, what do I do?

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++
« Last Edit: October 10, 2011, 12:29:49 am by MattJ812 »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: Win32++ errors
« Reply #4 on: October 10, 2011, 12:58:54 am »
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!

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

If you have a question on using Code::Blocks please post it hear.
You might try these links http://wiki.codeblocks.org/index.php?title=Off-site_documentation

Right now you need to learn how to program; I suggest reading the Code::Blocks FAQs and reading about Compilers and Linkers.

For C/C++ Programming I find this site good http://cboard.cprogramming.com/

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Win32++ errors
« Reply #5 on: October 10, 2011, 01:57:00 am »
I do not know your level of skill with programming, but I found all of these wikibooks 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.

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:
Code
comctl32
ole32
oleaut32
uuid
ws2_32

Offline MattJ812

  • Single posting newcomer
  • *
  • Posts: 5
Re: Win32++ errors
« Reply #6 on: October 10, 2011, 02:58:26 am »
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...

Code
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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Win32++ errors
« Reply #7 on: October 10, 2011, 06:54:30 am »
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.
[...]
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.
[...]
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.

Please learn the basics of c++ programming.
Learn the difference between scripting and compiling/linking, learn what compiling does, what the linking stage does etc.
And if you really want to learn that with gui-programming and not with simple and understandable, but probably more or less useless, console-programs, it's up to you.

But you are definitely on the wrong site here.
We do not teach basic programming here.
If you ask such questions, you are violating our forum rules, the rules you have accepted with registering here.

If you know what you want to do, but don't know where to do it in C::B, feel free to ask here (after reading the manual, the wiki and searching the forum).

Topic locked !