Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxWin Tutorial code, cant compile

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxWin Tutorial code, cant compile
#3101
Posted by: 2003-12-18 18:49:55
Hello, I've probably posted something similar... but this GUI programming really gets to me, I want to know how to do it but can't seem to get very far.

Here's what I have successfully done:
 - Downloaded Dev-C++ and the wxWindows v2.4.2 DevPack & installed them both
 - Downloaded the wxWindow tutorial PDF file by Franky Braem and started reading/working through it
 - I have successfully compiled a wxWindow project using the "New Project -> wxWindow Project" options in Dev-C++, so I do know that my Dev-C++ can actually do this.

What I can't seem to do is type *exactly* what is supplied in the wxTutorial PDF file and get it to compile. This means that I type exactly what is in the tutorial file but I always get failed compilations. The main errors I get - which **** me to tears just quietly - are like:

"In file included from TextEd.cpp"
"[Warning] extra tokens at end of #endif directive"

These errors point to the lines in the TextEd.cpp file that #include header files for the application. Like: #include "TextEd.h" and #include "TextFrame.h", which are all included in the project and typed character-for-character from the PDF file.

I've managed to find some other typo related errors and remove them, but I don't even understand what the above errors are saying let alone how to fix them. I have zipped and uploaded my source code to: http://www.beardmail.com/data/programming/cpp/TextEd.zip

If anyone can help me fixing this simple application I would appreciate it.

Message2. Re: wxWin Tutorial code, cant compile
#3102
Posted by: 2003-12-18 18:58:42
Oh yay, i worked it out. Some simple problems I didn't think would matter. the "In file bah blah" errors meant "In the file that the #include line links to there are invalid tokens after the #endif directive" the .h files had: #endif FILENAME_H, which I thought was legal. Is this illegal?

And another error was with the TextFrame constructor, the tutorial PDF shows the definition parameters like: TextFrame(const wxChar title ... ) and then the implementation is: TextFrame(const wxChar *title ...) which was causing compilation fail.

So now I have the frame compiling at least...
Message3. Re: wxWin Tutorial code, cant compile
#3108
Posted by: upCASE 2003-12-19 05:55:20
Hi!
Yes,  #endif FILENAME_H is "illegal" and causes an error.
Normally you find something like  #endif //FILENAME_H which of course is perfectly ok.

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message4. Re: wxWin Tutorial code, cant compile
#3109
Posted by: 2003-12-19 14:26:13
I've continued on through this tutorial. I'm now up to section 5, which covers Common Dialogs.

The tutorial takes you through making a little text editor and builds upon it. In this chapter it gets you to make some menu items to demonstrate the use of common dialogs.

I first tried adding the wxColourDialog to the menu. I got it down to one or two errors (which appears to be one causing the other). It was like:
"'wxColourDialog' undeclared (first use this function)
(Each undeclared identifier is reported only once for each
'dlg' undeclared (first use this function)
parse error before '(' token"

My guess at this is that 'wxColourDialog' is an unknown type, and it can't make the object when I have the line:
wxColourDialog *dlg = new wxColourDialog(this, &colourData);


I thought maybe I could try the wxFontDialog code instead, but it returns the same errors, except it has wxFontDialog in place of wxColourDialog.

Is there some more header files I need to #include to make these data types known?
Message5. Re: wxWin Tutorial code, cant compile
#3113
Posted by: upCASE 2003-12-21 03:06:41
Hi!
Include <wx/colordlg.h>

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message6. Re: wxWin Tutorial code, cant compile
#3190
Posted by: 2004-01-04 08:44:53
I am not even getting that far! Again, I can comiple and run a project using New Project -> wxWindow Project but entering the tutorial text as Catfish is doing I get the following error:

In file included from C:/Dev-Cpp/include/wx/wxprec.h:13,
                 from TextEditorApp.cpp:2:
C:/Dev-Cpp/include/wx/defs.h:179: redeclaration of C++ built-in type `bool'

...and several others like that! Is this a configuration problem?

Message7. Re: wxWin Tutorial code, cant compile
#3196
Posted by: upCASE 2004-01-05 19:13:33
Not a real config problem.
You're missing the needed #defines for your project. Check the old project settings and copy  the compiler and linker settings to the new one.
You can go to http://upcase.malteser-gl.de and find the settings there, too.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message8. Re: wxWin Tutorial code, cant compile
#4438
Posted by: 2004-06-12 18:02:35
Actually I had a similar problem. I ripped out all defines at the beginning of the file and still found no problem that I could find. I changed the define statements to have double quotes around them, changed the spacing, changed the placement, made sure that based on other classes that the EXACT same calls and yet nothing.

Solution?

Went back to Microsoft Visual C++. They are the monolithic empire that runs us all but hey, they do a nice set of development tools - the tools work, tonnes of online support forums with REAL help. Opensource/Linux types seem to be sooo snotty to noobies. I've had some pretty harsh remarks when asking for help - I've never encountered this sort of hostility in the Microsoft Development circles. Not the name calling I've encountered in the Opensource/Linux circles.

It's a real shame because the Opensource/Linux group is killing their opportunity to show Microsoft that there's any real competition. I don't find Opensource/Linux tools/S/W fun anymore - they don't work, they're not documented and the developers are not polite.

:/
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-4-14  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0