|
I have an error with my code and have no idea how to fix it |
Desmond Taylor
Member #11,943
May 2010
|
I am trying to make a basic game engine that all my games can run off. So basically just a skeleton of sorts. Anyway, the issue I am having is this... ||=== Build: Windows - Debug in game-engine (compiler: GNU GCC Compiler) ===| ..\include\system\input.h|22|error: expected ')' before '*' token| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| Now I cannot find the issue anywhere and have spent ages looking for it. Thought I would ask the professionals on this matter to see what I am missing. They do say that a second pair of eyes can spot issues easier. I have opened the source code to the public to get the issue fixed. You can get all the source code from my BitBucket repository. Any help on this matter will be highly appreciated. Thank you |
Arthur Kalliokoski
Second in Command
February 2005
|
I'm ignorant of C++, but I think it wants line 22 of system/input.h to be Input( (Events *) events ); instead of Input(Events* events ); just like you'd have (int *) myintptr HTH They all watch too much MSNBC... they get ideas. |
Peter Hull
Member #1,136
March 2001
|
My guess is that it doesn't know what Events is. You can either make sure that events.h is always #included before input.h or just put a forward declaration class Events; near the top of input.h
|
Desmond Taylor
Member #11,943
May 2010
|
Peter Hull said: My guess is that it doesn't know what Events is. You can either make sure that events.h is always #included before input.h or just put a forward declaration class Events; Thank you so much. I knew it would be something simple that I was missing. Like its said. Fresh eyes make such a difference. Thank you again. |
anto80
Member #3,230
February 2003
|
{"name":"my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/6\/e674cbf470d938c51ce4821abc79943b.jpg","w":735,"h":1116,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/6\/e674cbf470d938c51ce4821abc79943b"} ___________ |
Peter Hull
Member #1,136
March 2001
|
When looking at my own code I have one of two reactions: Quote: I can't believe I wrote that! or Quote: I can't believe I wrote that! Unfortunately it's mostly the latter.
|
Desmond Taylor
Member #11,943
May 2010
|
I laughed so hard when I read both of those new replies Yes, it was a little bit of a silly mistake. Can't believe that I didn't realize the mistake I made. I've never had that error before due to not forgetting to put the one line of code needed in the header until yesterday. Thanks again though, Since I could move on from that I've now wrote the sound class ready for my game engine The hardest part of it for me should be adding Multiplayer support since I have only worked with Winsock and I really want it to be cross-platform. Wish me luck on that one |
amarillion
Member #940
January 2001
|
It's not a silly mistake. Or maybe: all programming mistakes are silly mistakes. Imagine a Shakespeare play. There are 10000 words in it. But the playwright forgot a semicolon somewhere in the middle, and now the audience completely failed to parse it and misunderstood the plot. It was supposed to be a comedy, but due to that one missing semicolon, everybody listening interpreted it as a murder mystery. That's just what programming is like. -- |
anto80
Member #3,230
February 2003
|
I agree: that's not a silly mistake! In this part of the forum, we can be off-topic! This reminds me Quote: 0477 Ever spend ten minutes trying to find a single-character error?
___________ |
Peter Hull
Member #1,136
March 2001
|
amarillion said: It's not a silly mistake. Agreed. It amazes me that GCC produces such an unhelpful message in this situation. [edit] Some original research! class Input { public: Input(Events* events); private: }; GCC des.cc:3:15: error: expected ‘)’ before ‘*’ token Input(Events* events); ^ CLANG des.cc:3:9: error: unknown type name 'Events' Input(Events* events); ^ MSVC des.cc(3): error C2061: syntax error: identifier 'Events' Clang wins! For GCC if you put ')' where it says, it parses Input(Events); as if it were Input Events;
i.e. a definition of a variable called Events of type Input.
|
bamccaig
Member #7,536
July 2006
|
Desmond Taylor said: The hardest part of it for me should be adding Multiplayer support since I have only worked with Winsock and I really want it to be cross-platform. Wish me luck on that one Don't worry. Microsoft based Winsock off of Berkeley Sockets the same as every other UNIX OS. Microsoft's socket library is more limited, and you need to set up some pre-processor platform specifics at first, but after that most of it is shared code. And you're already used to Winsock so you won't miss any of the features in UNIX that you don't know about. Peter Hull said:
i.e. a definition of a variable called Events of type Input. What does it do with the trailing "events);"?! -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Desmond Taylor
Member #11,943
May 2010
|
bamccaig said: Don't worry. Microsoft based Winsock off of Berkeley Sockets the same as every other UNIX OS. Microsoft's socket library is more limited, and you need to set up some pre-processor platform specifics at first, but after that most of it is shared code. And you're already used to Winsock so you won't miss any of the features in UNIX that you don't know about. I'm glad to hear that as I think that is the part I shall be working on tomorrow evening. For now I am working on some basic physics that most games would need. Just want to release a better game than my last Picture Puzzle game back in January 2011 Shamefully written with SDL. Random Screenshot
{"name":"t8A8Gti.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/9\/d97afbaca575eab6c6b8a4d9a02a4169.png","w":348,"h":367,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/9\/d97afbaca575eab6c6b8a4d9a02a4169"}
|
Bob Keane
Member #7,342
June 2006
|
Desmond Taylor said: The hardest part of it for me should be adding Multiplayer support since I have only worked with Winsock and I really want it to be cross-platform. Wish me luck on that one Have you looked into Boost::Asio?It is cross platform and c++11 compliant. By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
Desmond Taylor
Member #11,943
May 2010
|
Quote: Have you looked into Boost::Asio? [www.boost.org]It is cross platform and c++11 compliant. I haven't! However that does look like it could do the trick. Thank you for that, It's now on my TODO/Look into list. |
Bob Keane
Member #7,342
June 2006
|
If you find great instructions on installing it and using it with VS, Code::Blocks or Netbeans, share the link. By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
Desmond Taylor
Member #11,943
May 2010
|
Sure will. Haven't found one myself yet so I'm just going to make a test project and swing it. I use Code::Blocks so if I manage to get it working I can share the steps taken. Someone might be able to make it easier from that. |
Bob Keane
Member #7,342
June 2006
|
Did you get the Windows SDK to work with Code::Blocks? By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
Desmond Taylor
Member #11,943
May 2010
|
I have not. I keep getting errors but I wont give up as it sounds too good to just throw away. |
Bob Keane
Member #7,342
June 2006
|
These instructions suggest it can be done, but you have to use a nightly build. The download page for the build is Jen's Fedora Page, which suggest it is only for Linux. I tried the instructions but my project can't find the Ws2_32.lib. There is a slight chance the global settings are overriding the debug settings, or vice versa. I tried it with the regular download, not the nightly build btw. By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
Desmond Taylor
Member #11,943
May 2010
|
why cant it find ws2_32? its winsock so it should work. But I shall look into that maybe tomorrow. As of now I've promised some friends to play some Minecraft with them. |
Bob Keane
Member #7,342
June 2006
|
It looks like a common problem per Google. One solution was the global settings were overriding the debug settings. I'll test it Saturday. Figuring out how to get around my anti virus software is going to be fun. My laptop may be iffy. I updated flashplayer at least twice in the last two weeks and I got an update notice again tonight. By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
Gideon Weems
Member #3,925
October 2003
|
Desmond Taylor
Member #11,943
May 2010
|
I still can't get Boost:Asio to work. Going to look up on it a lot more as it sounds too good to just give up on. Even though my game engine is not being worked on due to this XD I blame you Bob Keane |
Bob Keane
Member #7,342
June 2006
|
Desmond Taylor said: I still can't get Boost:Asio to work. Are you following these instructions? It says there is an installer but I can't get it to work. Desmond Taylor said: I blame you Bob Keane If it makes you feel better, I had a horrible night at my night job. One huge problem, and lots of little ones. I think I'll boot up a computer game and go on a rampage. They'll curse my name on the Sword Coast. No evil grin emoticon? By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul. |
|