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 / Troble with concating char* for dbPrint()

Author
Message
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 7th Nov 2009 22:49 Edited at: 7th Nov 2009 22:50
Right now I'm working on a project to try to port all of the code used in Johnathan S. Harbour's DarkBASIC Pro book, and make it DarkGDK compatible code.

I'm having a little trouble trying to concat some char* variables.

Here is the code:


I'm getting this error upon building:

1>LINK : fatal error LNK1561: entry point must be defined

http://twewy-fan.com/ <-- The first ever fansite for "The World Ends With You"
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 8th Nov 2009 02:08
You're declaring buffer as a pointer but it doesn't do any good until you have it pointing to something. In this case you want to do

char *buffer = new char [256];

to declare enough space to put any amount of reasonable text in it.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 8th Nov 2009 05:20
Well, Tried it, still get the same compiling error.

http://twewy-fan.com/ <-- The first ever fansite for "The World Ends With You"
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 9th Nov 2009 21:39
That error message has nothing to do with strings. It tells you that the compiler does not recognize the "void DarkGDK()" function as a valid program entry point. Did you create the project using the Dark GDK game wizard or created an empty project in Visual Studio? Use the wizard to make a new project and try again.

However, Lilith was correct in saying that your buffer handling can be improved too, after you manage to get the code to compile. You can either use her suggestion and "new" the buffer (but then it's advisable to delete it somewhere too, after you're done using it) or declare it as a static char array: char buffer[256]

It is also advisable to delete the returned string if you are using a Dark GDK function which returns char pointer (like the dbSpaces function), to avoid memory leak.

Login to post a reply

Server time is: 2024-11-20 11:37:18
Your offset time is: 2024-11-20 11:37:18