User forums > Using Code::Blocks

Win32++ errors

(1/2) > >>

MattJ812:
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();
}
--- End code ---

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 ===|

--- End code ---

I assume I have some paths wrong, what should I do?

Thanks.

oBFusCATed:
You're missing link options.

Please invest some time to read our FAQ -> http://wiki.codeblocks.org/index.php?title=FAQ
Especially:
1. http://wiki.codeblocks.org/index.php?title=FAQ#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
2. http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

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

Alpha:
And:
3. My build fails with multiple undefined reference errors


--- Quote from: oBFusCATed on October 09, 2011, 11:50:42 pm ---BTW: why don't you try something a bit more modern like wxWidgets or QT? Win32 and MFC are vastly outdated!

--- End quote ---
I second that.

MattJ812:
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++

stahta01:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version