944,072 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1550
  • C++ RSS
May 28th, 2007
0

need help with error

Expand Post »
Hello, I'm a new programmer and wanted to create a simple windows application. I might be getting in a little over my head when writing the code below. All seems well when compiling the code without implementing classes. When I implemented the class AppEngine from a separate source file I had these errors that I could not resolve. I came to two conclusions of what I was doing wrong and was hoping that someone could point me in the right direction.

Conclusion 1 - I incorrectly included the source files during compile
Conclusion 2 - I was in over my head and should not attempt windows programming just yet.

The errors I'm receiving are:
Line 12 : new types may not be defined in a return type
Line 4 : requires init-declaration before LRESULT WindowProcedure

I use DEV C++ IDE and these the codes that gets the error.

1 #include <windows.h>
2 #include "DCPPPClasses.h"
3
4 LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT 5 message, WPARAM wParam, LPARAM lParam);
6
7 AppEngine *_pAE;
8
9 _pAE = new AppEngine(HINSTANCE, LPSTR, LPSTR, WORD, 10 WORD, int, int);
11
12 int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevi, 13 LPSTR szcmdline, int icmdshow)
14 {
15 }

I would like to know what those error means and how to fix them. Thanks in advance. Sadaka
Quote ...
If poking it with a stick doesn't work for you. Try poking it with a bigger one.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sadaka is offline Offline
23 posts
since May 2007
May 28th, 2007
-1

Re: need help with error

how bout using a better api? qt or gtk are much easier.
Reputation Points: 343
Solved Threads: 24
Veteran Poster
Sturm is offline Offline
1,067 posts
since Jan 2007
May 29th, 2007
0

Re: need help with error

line 4: LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT 5 message, WPARAM wParam, LPARAM lParam);
line 9: _pAE = new AppEngine(HINSTANCE, LPSTR, LPSTR, WORD, 10 WORD, int, int);

these are the errors. the compiler/ide you are using seems to emit very poor error messages.
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
May 29th, 2007
0

Re: need help with error

also line 12: int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevi, 13 LPSTR szcmdline, int icmdshow)
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
May 29th, 2007
0

Re: need help with error

That's what you get when you copy-paste code... De lines got messed up, and now the linenumbers are in your code:
In line 4: Remove '5'
In line 9: Remove '10'
In line 12: Remove '13'
Last edited by Nick Evan; Mar 26th, 2010 at 8:52 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
May 29th, 2007
0

Re: need help with error

I added the numbers to indicated the line. I thought it would help indicate which line generated the errors. I figured that I included the external source files incorrectly and that the complier didn't recognize any of my class calls hence error : new types may not be define in a return type. I want to know what that error means because I tried everything I could think of to resolve it but in vain. Next time I'll just attach my source files so there won't be any confusions. Sorry. Thanks again in advance.
Quote ...
Things aren't always what it seems my young grasshopper...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sadaka is offline Offline
23 posts
since May 2007
May 30th, 2007
0

Re: need help with error

check the header DCPPPClasses.h for a missing ; at the end of the class, mismatched (), {} etc.
line 9: _pAE = new AppEngine(HINSTANCE, LPSTR, LPSTR, WORD, 10 WORD, int, int); is an obvious error on many counts.
Last edited by vijayan121; May 30th, 2007 at 2:47 am.
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
Jun 10th, 2007
0

Re: need help with error

oh yes duh... i'm such a dueche bag that's what I left out after the class. Thanks alot bro. i've attached my source if you want to look them over. Thanks again. I've also made changes to the class and added the colon (. Think that I can attach stuff?
Quote ...
A good deed will not go unnoticed. -Sun Tsu
Attached Files
File Type: cpp DCPPP4.cpp (3.8 KB, 13 views)
File Type: h DCPPP4.h (2.4 KB, 8 views)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sadaka is offline Offline
23 posts
since May 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Hi, How to access and read .csv files in C++
Next Thread in C++ Forum Timeline: Popup Menu displays as very thin box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC