Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help With Simple Program

Author
Message
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 11:56
Hi guys. Can anyone tell me where I am going wrong with the following code?:



That is the entire program and I am just running a few tests to see if I can get the hang of it; It looks like I cant

Many thanks to anyone who can help

Freedom Fighters
15
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 15th May 2010 12:52
is anything going wrong?

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 12:54
The program is not having a successful compile... It says there was 1 error which prevented the program running... It looks like the problem is the dbMakeFile("Test.txt"); line (it works without that), but I have no idea what is wrong with that...

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 15th May 2010 13:06 Edited at: 15th May 2010 13:06
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 15:11
Still gives me problems... (same errors). Is there anything I need to do to enable GDK in one of these projects? I just created a blank projects and used the code shown in the first post. Do I need to manually add things to the header ect...?

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 15th May 2010 16:26 Edited at: 15th May 2010 16:27
how about, post the errors?

well i think you cant use any GDK function without having your code inside void DarkGDK ( void ) {...}

also, dbWaitKey should be dbWaitKey ( );

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 15th May 2010 16:40
Try using one of the DarkGDK wizards when creating a new project.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 15th May 2010 16:45 Edited at: 15th May 2010 16:54
That code won't work and here's why:

1) int main() GDK uses its own main/winmain. We are left with using void DarkGDK(void) as our entry point within the application.

2)cout << "..." will output the text to the screen - or otherwise default output stream. This is great when writing console apps, but GDK already takes over the window and makes it a DX window - ie: cout << "..." doesn't work. This shouldn't stop the program from compiling tho.

So, try this code instead:




JTK
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 15th May 2010 17:57
If you want to use cout/cin/clog etc use this to open up a console window.

"A computer once beat me at chess, but it was no match for me at kick boxing."
Emo Philips
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 18:50
Thanks guys JTK, your code worked great Even went a bit further and added a bit of text in the file

Just one last question guys. I have modified the code very slightly (just added a small piece of my own into the loop because i know the loop works properly ). Below is my code. The program doesnt build :S And when it does - remove this line
- then no sprites appear :S I know that the files loaded do in fact exist...



Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 15th May 2010 19:04 Edited at: 15th May 2010 19:04
Try


JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 15th May 2010 19:40 Edited at: 15th May 2010 19:42
I'll bet this is the culprit...



It should be:



Notice the double-backslashes \\. C/C++ strings are strange in that they use a backslash character to indicate a control character will follow. In order to get an actual backslash, the "control" character to follow would be another backslash, thus two are needed.

Hope this helps,

JTK

Edit: Oh, and, what Matty was saying too...
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 20:11 Edited at: 15th May 2010 20:12
Okay guys, thanks for the help so far. Just got a bit more to do. The program still is experiencing problems (even with the suggested modifications). The new code is attached as well as the error message. Im not sure what it could be, if i figure it out during my usual star off with the code, i'll remove it.

SOURCE CODE:


ERROR CODES:


Thanks for all the help guys, Arenas.

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 15th May 2010 20:22
The error message tells you exactly where to look for the problem: line 18

What to look for: "missing ) before ;"

So, looking at line 18:


We can see that it's correct... It should be:



You have to put some effort into figuring out the troubles you're having.

JTK
A r e n a s
16
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 15th May 2010 23:01
Im really sorry if it seems like im just getting you guys to do all the work for me.. Its my second day with GDK :/... I dont know what any of the errors mean or anything like that, no matter how obvious it seems. I'll learn and remember all of this stuff later as I continue to learn GDK

Login to post a reply

Server time is: 2024-11-19 23:36:30
Your offset time is: 2024-11-19 23:36:30