FAQ for IDE related issues v2 Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

FAQ for IDE related issues v2

Post by Jorg »

"Cannot open include file: "wx/setup.h"... "
  • This error is very common amongst people new to wxWidgets, using VS6 or VS7 or anything else on Windows. On the Linux platform this will be not present due to the configure command. To solve this, simply copy the file setup.h from /lib/msw (or /lib/mswd) to /include/wx.
Last edited by Jorg on Tue Jan 18, 2005 3:49 pm, edited 2 times in total.
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

How to setup MS VISUAL STUDIO .NET 2003

OK, I'll try to explain installation, configuration and testing step by step... (windows XP)

INSTALLATION

1. Download wxMSW-2.5.3.zip
2. Unpack it
3. Open wxWidgets-2.5.3\src\wxWindows.dsw (I use VS.NET 2003)
4. In Solution explorer select wxWindows project
5. Go to "Properties -> C/C++ -> Code Generation -> Runtime Library"
6. Change "Multi-threaded Debug DLL (/MDd)" to "Multi-threaded Debug (/MTd)" for Debug configuration
7. Change "Multi-threaded DLL (/MD)" to "Multi-threaded (/MT)" for Release configuration
8. Press OK
9. Do 5-8 for "expat", "jpeg", "png", "regex", "tiff", "zlib" project of the workspace (see * below for alternate solution without Multitrhreaded Debug setting)
10. Select "Build -> Build Solution" :)
11. Change current configuration from Debug to Release
12. Select "Build -> Build Solution" :))))
13. Close the workspace
14. Copy wxWidgets-2.5.3\include\wx\msw\setup.h to wxWidgets-2.5.3\include\wx\setup.h

MINIMAL CODE

1. Create new empty Win32 project (MinTest)
2. Create new CPP file (Solution Explorer -> Source Files -> Add new item)

Code: Select all

	#include <wx/wx.h>

	class MyApp : public wxApp
	{
	public:
		virtual bool OnInit();
	};

	IMPLEMENT_APP(MyApp)

	bool MyApp::OnInit()
	{
		wxFrame * frame = new wxFrame(NULL, -1, "Test");
		wxMenu * menu = new wxMenu;
		menu->Append(wxID_EXIT, "Close\tAlt+F4");
		wxMenuBar * menubar = new wxMenuBar();
		menubar->Append(menu,"File");
		frame->SetMenuBar(menubar);
		frame->Show();
		SetTopWindow(frame);
		return true;
	}
3. Go to "Properties -> C/C++ -> Code Generation -> Runtime Library"
4. Change "Multi-threaded Debug DLL (/MDd)" to "Multi-threaded Debug (/MTd)" for Debug configuration
5. Change "Multi-threaded DLL (/MD)" to "Multi-threaded (/MT)" for Release configuration
6. Add "wxmswd.lib comctl32.lib uuid.lib rpcrt4.lib" to "Properties -> Linker -> Input -> Additional Dependencies" for Debug configuration
7. Add "wxmsw.lib comctl32.lib uuid.lib rpcrt4.lib" to "Properties -> Linker -> Input -> Additional Dependencies" for Release configuration
8. Build the project (Debug and Release)

TESTING

1. Install Windows 98 under VMWare workstation (CUSTOM INSTALLATION, NO COMPONENTS SELECTED. IT IS AN EMPTY SYSTEM)
2. Add Physical drive to the Virtual Machine devices
3. Start Virtual Machine
4. Start the application 'MinTest\Debug\MinTest.exe' (2 162 688 bytes)[IT WORKS]
5. Start the application 'MinTest\Release\MinTest.exe' (770 048 bytes) [IT WORKS]

(*) Addition for the die hard VS7 fans:

You can perform a Batch build as well. Select Build | Batch Build and sort the order on solution type, e.g. so that Debug and Release are neatly sorted. Now check all projects you like to build, and press [Rebuild All]
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
daddydave
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 214
Joined: Wed Jun 15, 2005 3:31 am
Location: United States
Contact:

Re: FAQ for IDE related issues v2

Post by daddydave »

Jorg wrote:"Cannot open include file: "wx/setup.h"... "
  • To solve this, simply copy the file setup.h from /lib/msw (or /lib/mswd) to /include/wx.
The path Jorg said to copy setup.h from may vary. If using MSVC, you'll probably find setup.h in lib\vc_lib\msw\wx (release) or lib\vc_lib\mswd\wx (debug)
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

How to setup MS VISUAL STUDIO EXPRESS/2005

Read

http://xurble.org/weblog/2004/10/using- ... press.html
[Mostly retired moderator, still check in to clean up some stuff]
rssmps
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jun 24, 2006 6:19 am

unresolved external symbol _main

Post by rssmps »

LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup


if you get this and you're app is using/building GUI, it's likly you're using console rather than window.

project|properties|Linker||System|SubSystem: change console to windows.
Last edited by rssmps on Thu Jun 29, 2006 5:22 pm, edited 4 times in total.
rssmps
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jun 24, 2006 6:19 am

Post by rssmps »

Should this be part of the FAQ?

src\wxWindows.dsw vs. build\msw\wx.dsw
http://forums.wxwidgets.org/viewtopic.p ... indows+dsw
rssmps
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Jun 24, 2006 6:19 am

Post by rssmps »

One tip on running the samples. I found that the the sample solutions willl compile certain lib files depending on what is attached.

So the impact is that if you built the library first and then ran the samples, your orig lib settings will be overwritten with the settings in the sample.
huehnerschrecker
In need of some credit
In need of some credit
Posts: 1
Joined: Sun Jul 29, 2007 10:31 am
Location: Germany

KDevelop and wxWidgets macros (remove c++ parser errors)

Post by huehnerschrecker »

If you prefer to use KDevelop and don't want the c++ parser to mark the wxWidgets macros as an error (or the parser complains about a missing semicolon ) simply add them to the predefined headers.
Goto Settings->Configure KDevelop. Scroll down to C++ Parsing and insert the wxWidgets (or your own) macro definition into the "Special Headers" box, eg:

Code: Select all

#define DECLARE_EVENT_TABLE() 
#define BEGIN_EVENT_TABLE(theClass, baseClass) 
#define END_EVENT_TABLE()
If you are unsure about the correct macro definition to use, take a look at the corresponding header file, wx/event.h for example and use the definition as listed there.
If the parser is still complaining afterwards, change the file a little (insert a character and delete it afterwards), save the file and thus force the parser to parse again. The warning should be away now. Good luck
My kingdom for a good signature
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Post by ONEEYEMAN »

huehnerschrecker,
According to the KDevelop team, this will not required for KDevelop 4.

Thank you.
Edgar
Knows some wx things
Knows some wx things
Posts: 40
Joined: Sun Sep 13, 2009 3:55 am

Re: FAQ for IDE related issues v2

Post by Edgar »

Jorg wrote:"Cannot open include file: "wx/setup.h"... "
  • This error is very common amongst people new to wxWidgets, using VS6 or VS7 or anything else on Windows. On the Linux platform this will be not present due to the configure command. To solve this, simply copy the file setup.h from /lib/msw (or /lib/mswd) to /include/wx.
Compiling wxWidgets 2.8.10 with Visual Studio 2010
In 2 header files (platform.h & gsockmsw.h) I have had to make the following changes:
//#include "wx/setup.h"
#include "wx/msw/setup.h"
because setup.h does not exist in the originally named directory.

Obviously, given that Jorg's original post was dated October 2004 and is the very 1st item in the FAQ, why hasn't this been repaired in the distribution source?
--Edgar
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: FAQ for IDE related issues v2

Post by Auria »

Edgar wrote:
Obviously, given that Jorg's original post was dated October 2004 and is the very 1st item in the FAQ, why hasn't this been repaired in the distribution source?
I'm not very familiar with Windows; but I'm pretty sure nothing needs to be 'repaired' because it's not a bug. I think setup.h is put there as part of the normal installation process (how it's done is unknown to me though)
"Keyboard not detected. Press F1 to continue"
-- Windows
Edgar
Knows some wx things
Knows some wx things
Posts: 40
Joined: Sun Sep 13, 2009 3:55 am

Re: FAQ for IDE related issues v2

Post by Edgar »

Auria wrote: I'm not very familiar with Windows; but I'm pretty sure nothing needs to be 'repaired' because it's not a bug. I think setup.h is put there as part of the normal installation process (how it's done is unknown to me though)
It depends on your definition of "bug"! If the developers provide a solution for the Microsoft Visual Studio users and every single user must make an edit to the source code before the solution will compile (and it's been that way for at least 6 years) I would call that at best an annoyance and at worst a bug. I realize that this is a very complicated cross-platform project and that for users of UNIX this problem does not crop up. Still, I think that a solution can be found for Windows users which would not cause problems for other platforms.
--Edgar
blaroche
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Jun 10, 2010 9:04 am
Location: Germany

Post by blaroche »

I have the same problem. I cannot compile even the Hello World sample because wx/setup.h is missing. Jorg's post assumes that setup.h is in /lib/msw, but I don't even have such a folder. It also seems like it's the case for other users.

I looked at dozens of websites that explain how to use wxWidgets, but none has worked for me.

Is there a standard simple way to run wxWidgets applications on Windows?
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

blaroche wrote:I have the same problem. I cannot compile even the Hello World sample because wx/setup.h is missing. Jorg's post assumes that setup.h is in /lib/msw, but I don't even have such a folder. It also seems like it's the case for other users.

I looked at dozens of websites that explain how to use wxWidgets, but none has worked for me.

Is there a standard simple way to run wxWidgets applications on Windows?
Mingw or VC++?
If Mingw, use mignw32-make from terminal - always worked for me.
If VC++, open the VC projects and build - worked for me too I think (though I only tried once some time ago)
"Keyboard not detected. Press F1 to continue"
-- Windows
blaroche
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Jun 10, 2010 9:04 am
Location: Germany

Post by blaroche »

I installed CodeBlocks, which came with mingw32-make.

I tried the following:

Code: Select all

C:\wxWidgets-2.8.11\build\msw>"C:\Program Files (x86)\CodeBlocks\MinGW\bin\mingw32-make" -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release clean
and got this:

Code: Select all

if exist gcc_mswudll\*.o del gcc_mswudll\*.o
process_begin: CreateProcess(NULL, -c "if exist gcc_mswudll\*.o del gcc_mswudll\*.o", ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: [clean] Error 2 (ignored)
and this went on for about 300 lines.
Locked