Page 1 of 1

getting started in VS2010

Posted: Fri Jun 18, 2010 1:12 am
by Aisthesis
Please forgive me any totally stupid questions, but this is my first attempt at any kind of GUI programming in C++, so I'm swimming in terms of how to set this up. Trying to follow the instructions in Smart, Hock, Csomor, appendix A for doing this.

First I downloaded the self-extracting files and extracted. No problem there as far as I can tell.

Next step according to book, p. 547 seems to be opening build/msw/wx.dsw. When I do that, it asks to convert to newest VS, and I click OK. Takes a while and acts like it's converting the 20 files (or, properly, projects within the solution wx?).

The wxregex project is then bold in the directory on the left of the window. Now I click build (with just the default 'Debug' selected in the menu box where I can select things like 'Debug DLL', 'Debug Unicode', etc.), and, although I got a failure or 2 the first time through, when I clicked build again, it built everything successfully.

But (before even getting to my difficulties in opening the code in the samples solution) now if I click save all in the file menu and then close VS2010, I have to go through the whole process again if I try to re-open wx.dsw. It's as if no conversion has really happened, and that seems weird.

I'll leave it at that for now, as something seems wrong with these first steps, and that's possibly the reason why I'm unable to do anything with the samples/samples.dsw solution.

Any help much appreciated!!

Posted: Fri Jun 18, 2010 1:27 am
by Aisthesis
still not there, but I figured out at least what that problem was: The old VS6 file is still there but a new workspace for VS2010 is also created. When I open that one, everything seems up-to-date.

Similarly when I do the same thing for samples/samples.dsw except that when I build, I get 4 failures out of the 76 projects. Here is the full output when I try to build:

Code: Select all

1>------ Build started: Project: penguin, Configuration: Debug Win32 ------
2>------ Build started: Project: isosurf, Configuration: Debug Win32 ------
1>Build started 6/17/2010 8:23:18 PM.
2>Build started 6/17/2010 8:23:18 PM.
2>  Touching ".\vc_mswd\isosurf\isosurf.unsuccessfulbuild".
1>  Touching ".\vc_mswd\penguin\penguin.unsuccessfulbuild".
3>------ Build started: Project: cube, Configuration: Debug Win32 ------
3>Build started 6/17/2010 8:23:18 PM.
3>  Touching ".\vc_mswd\cube\cube.unsuccessfulbuild".
4>------ Build started: Project: dbtest, Configuration: Debug Win32 ------
4>Build started 6/17/2010 8:23:18 PM.
4>  Touching ".\vc_mswd\dbtest\dbtest.unsuccessfulbuild".
1>  penguin.cpp
2>  isosurf.cpp
3>  cube.cpp
4>  dbtest.cpp
1>penguin.cpp(24): fatal error C1189: #error :  "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
1>  dxfrenderer.cpp
3>cube.cpp(24): fatal error C1189: #error :  "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
2>isosurf.cpp(24): fatal error C1189: #error :  "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
4>dbtest.cpp(70): fatal error C1189: #error :  Sample cannot be compiled unless setup.h has wxUSE_ODBC set to 1
2>Build FAILED.
2>Time Elapsed 00:00:04.11
4>Build FAILED.
4>Time Elapsed 00:00:03.93
3>Build FAILED.
3>Time Elapsed 00:00:04.60
1>dxfrenderer.cpp(27): fatal error C1189: #error :  "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
1>  Generating Code...
1>Build FAILED.
1>Time Elapsed 00:00:06.34
========== Build: 0 succeeded, 4 failed, 72 up-to-date, 0 skipped ==========

This looks like I need OpenGL and then to set some variables to 1. How?

Posted: Fri Jun 18, 2010 1:37 am
by Auria

I recommend peeking a bit in the forum (don't have direct links, sorry), the wxWidgets VS files are known not to work on VS 2010. You can use VS 2008, or browse the forum for fixes until it's fixed

Posted: Fri Jun 18, 2010 1:41 am
by Aisthesis
also, i'm getting only error messages when i try to run anything in the samples Solution--although i'm also not even completely sure that i'm understanding the function of the samples correctly.

just to give some idea of where i'm at in terms of background: i'm decent in doing console applications in C++ and have done a little GUI programming in Java, so now i'm making the attempt to do some GUI programming in C++.

what would be extremely helpful would be just to see the code for an ultra-simple window (like the Minimal wxWidgets App in Smart et al., p. 15) in a context where i would be able to run it in VS2010 to get the window to open--and i could also see how one in principle links up with the wxWidgets libraries.

Posted: Fri Jun 18, 2010 1:49 am
by Aisthesis
sigh... i noticed that others were having trouble with VS2010. i'm not really seeing downgrading back to vs08.

it looks to me like the basic build worked, and there are at least a fairly limited number of errors when i try to get into the samples. With a complex program/library that I don't know, though, i hate to go fiddling around in the configuration files without exact instructions from someone who knows what they're doing...

Posted: Fri Jun 18, 2010 3:26 am
by Aisthesis
ok, after looking at the error messages and getting confirmation from the book on p. 549, I just went into the setup.h file and changed definitions of wxUSE_GLCANVAS AND wxUSE_ODBC to 1. Then the whole samples solution successfully builds.

what i still don't understand is what i now actually have. i naively just clicked on run afer the successfull rebuild (the artprov project is bold in the list on the left) and got an error window with the message:

"Unable to start program 'C:\wxWidgets-2.8.11\samples\Template\artprov.exe'.

The system cannot find the file specified"

It seems to me like the samples probably aren't even supposed to be executable at this point (??). They're supposed to be built correctly in any case.

Is there some kind of "Hello World" for rank beginners in wxWidgets that i can either copy from somwhere or type a few lines of simple code just to get started?

Posted: Tue Jul 06, 2010 6:24 pm
by Sami Hamlaoui
As you found out, when you convert project files with VS2010 it doesn't overwrite the old ones (as the .dsw is a different format), but instead saves them in the format native to the version of VS you're currently using.

Also, VS2010's conversion isn't perfect for wxWidgets. I uploaded a set of fixed project files for 2010 for wxWidgets 2.9.0 here ( Nobody has replied to the thread, so I can only guess that they are working (otherwise it would've generated a lot of whinging :P).