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 Strings

Author
Message
Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 28th Dec 2007 01:45
Can't get this code to compile.. Any ideas?


This isn't in my main.cpp, its in paLib.cpp. It won't compile because of the line that says resolution = "ad"; and I don't know why. I already got a few other functions working fine, but I can't seem to get anything to do with strings working well. If you comment out that line I mentioned, it compiles. Ideas??

Thanks,
Mason


CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 28th Dec 2007 01:47
only because Ive seen others mention this (i'm not a c++ coder)...

strings.h ?

My DBP plugins page is now hosted [href]here[/href]
Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 28th Dec 2007 02:05
yeah, I forgot to paste that into the code box above, it has #include "string.h". I wish that was the problem or I would be coding again

Heres the output of the compiler if this helps anyone?



jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 02:07
Yup - that's a great START! Also, STDLIB.

Then there is my way:
my jfc_string.h






my jfc_string.h (which uses string.h)


Sample:


you'll figure out the rest

Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 28th Dec 2007 02:12
Thats a pretty good string library, your write that? I just want to get the regular strings working because I'm going to be doing a lot of manipulations with strings and It would be nice if it worked.. Any more ideas please?

Thanks a lot though Jason, just kind of frustrating that I can't get this to work when I use GDK; I want to finish my project


jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 02:20
Yes I wrote that - yes it works - no its not done - but like you - I wanted to get game making and crashed through enough C++ to get proficient - but didn't honestly feel like learning a million things so that I coded "Main Stream" - (Which I do all day, everyday at work - in all sorts of languages - database stuff etc... game coding MUST be fun or I won't do it!

I wrote my double linked list stuff to get arays - but they are a bit verbose, and a bit tricky - but I KNOW them because I wrote them originally in FreePascal - for a multi-threaded server and some CGI web stuff I wrote from scratch.

there is another thread on here - "Ted terrain" - I released a whole slew of source there - and another - Frustrum Limb Culling for GDK - ported from Lost in thought's Dbpro port...

(That is smaller) Snag that stuff and see if you can't figure it out if you want.

But tto get jamming - I gave ya the simplest string stuff I could that is fairly functional for the basics. Note in the double linked list stuff... there is a tokenizer - albeit a lame one. I wrote a SLAMMING one capable of parsing HUGE files, multi-line stuff - completely 100% configurable BUT.... It's a mile long and I was like...um... NOT TODAY!

Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 28th Dec 2007 03:17
I'm not a big fan of linked lists, wrote one in Java in a class that I was taking. Took me a long time to understand.. I'm going to try out what you gave me but In the mean time, anyone know whats wrong dag...


jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 04:00
Have you tried Excluding LIBCMT.LIB from linker "input" or whatever. Often libcmtd.lib and atls.lib might be a pain too.

Anyone else KNOW what's up with those linker Errors?

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 28th Dec 2007 10:57
Mason, the error message you have posted is not a compiler error, but a linker error. And it says that some of the code you are trying to use is not properly linked into your executable. This is mostly caused by forgetting to add a library dependency to your project setting when you use its functions in the project. In your case, it is very likely one of these libraries:

LIBCD.LIB, LIBCMTD.LIB, LIBC.LIB, LIBCMT.LIB

Which one it is depends on your project configuration, since all of them contains the same symbols, but are written for different configurations. The *MT* versions are for multithreaded usage and the *D versions are for debug build.

When you use any library function in C++, you need to add both - the library header (.h file) to your includes and the library itself (.lib) where the compiled symbols are located. You can do this in Project settings - Linker - General - Input libraries.

I hope this will help you a bit. Its a lot more complex than I am showing here, so I rather suggest to learn C++ before you actually start using it. (no offense, just a suggestion, you will save yourself a lot of hours)
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Dec 2007 15:00
Quote: "I rather suggest to learn C++ before you actually start using it"


He's right - there is a lot of stuff to learn and know. However if you wish to just make it work for now... you can do what I do when I get befuddled.

I Make a New vs2008 GDK Project - 3d. Then I copy my *.cpp and *.h files to it, I remove the Default main.cpp and of course add mine.

This saves me from needing to memorize every setting to make the compiler happy. However, I try to use only my own support libs where possible - so I have for the most part a self contained source base. If you use a ton of Windows SDK, DirectX SDK, and some other things like Newton, Agiea or whatever - then my approach won't likely work for you - it might - but - again - its definately SPACKLE to cover the hole in the wall versus putting up nice new sheetrock.

Mason
20
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 29th Dec 2007 00:13
Alright, after a lot of caffeine (love my tea ) I figured out the problem. All I had to do was change the compiler from Multi-threaded Debug (/MTd) to Multi-threaded (/MT). Now strings and all the other library's work fine.

If anyone else is having this problem, just change that setting. Press alt-F7. Then expand 'Configuration Properties', then expand 'C/C++', then click 'Code Generation'. On the right, change Runtime Library to Multi-Threaded (/MT). Should work out.

Thanks a lot for the help Tempicek and Jason. Toast


tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 29th Dec 2007 01:55
Quote: "All I had to do was change the compiler from Multi-threaded Debug (/MTd) to Multi-threaded (/MT)."


Indeed, this is the other way to solve the problem.

Still it is a good practice to use the runtime library according to build setting, which means - use debug version (/MTd or /MDd) for debug build and standard version (/MT or /MD) for release build. Just a note for future reference...
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 3rd Jan 2008 06:05
MS really need to sort out their linked libraries. I just want to write code but I waste hours sorting out linker errors with MS libraries and code that runs fine as release but not with debug libraries. It should not be like that.

If you read the linker error help from MS for some of those errors it is extremely confusing working out what to exclude and what can be used instead of something else and what is m/t versus s/t and then DLL versions and then exceptions to the rule of all of the above. Multiple defined symbols and symbols missing and ... aaaaaargh... the code is fine... it compiles sweetly as release version... please MS give me a linker thst just links it for me in debug mode without so much stress.

You even get linker library porting issues when you upgrade compilers from say VC 6.0 to 2008. Some of my apps keep asking for the VC 6.0 debug library so I have to set the whole project up again from scratch. So much for the upgrade wizard.

m0ng00se
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 3rd Jan 2008 11:39
Quote: "MS really need to sort out their linked libraries."


Not sure if this is a MS's problem. It's a bit confusing until you get familiar with it, but it makes sense eventually. Actually, you would have to sort it out using any other compiler as well, it's just a result of messing up with other build configuration. (Here applies the rule "don't touch it if you don't know what it does".)

Quote: "You even get linker library porting issues when you upgrade compilers from say VC 6.0 to 2008."


This is a bad habbit, indeed. It results from the fact that they have changed the default behavior of some project settings, even removed some older stuff (like single-threaded linking - it's not supported any more and if you use MT, you have to change the runtime linkage). So I guess they could have some autorepairing process which would ask you "May I try to corrent your C runtime linkage setting?" and you would have the choice to say No. Fortunately it's not that common situation.

Quote: "If you read the linker error help from MS for some of those errors it is extremely confusing"


Hm, the documentation is quite extensive and you don't always find what you are looking for (but it's most often there). It's rather that a beginner don't understand what it actually means, so some simple "howto" would help a lot I guess. I think I will add some note here later because these problems are mentioned too often...
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 3rd Jan 2008 13:19
I agree with you that I don't understand all the twenty million linker errors. Especially when I mostly get them with code that used to run fine or still does run fine as release version.

You are right of course but I want to spend my time writing animation code or AI code because that's why I learnt code and why I have a compiler. I have no interest in linkers or linker messages or debug libraries. None at all. They are boring as last month's toast left out in the sun till it's crumbled away.

You can say those linker errors are well documented but "undefined symbol gobblygook@4r%$^& blah yadda in ^^%$#$#@library blah" or whatever it says just doesn't give me a hard on at all.

-m0ng00se (tired and cranky at 1.18 am in NZ with a psycho linker)
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 3rd Jan 2008 14:39
Considering your rant in a few other threads - C++ this and Assembly Language That, and a previous job as a security Consultant - I'm quite surprised linker problems are such a road block for you.

Jeesh.

tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 3rd Jan 2008 15:32
Quote: ""undefined symbol gobblygook@4r%$^& blah yadda in ^^%$#$#@library blah" or whatever it says just doesn't give me a hard on at all."


Ok, ok. You forced me to do this I've started a new thread where I am trying to help solve these issues. Hope this will in the future: http://forum.thegamecreators.com/?m=forum_view&t=121186&b=22
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 3rd Jan 2008 22:47
Sorry all, I was tired and I've been trying to solve a linker issue for three weeks when all I want to do is get on with writing my code. After all the code is good and trying to work out libraries has nothing at all to do with C++ or my program or the code logic or OOP.

-m0ng00se

Login to post a reply

Server time is: 2024-11-19 23:25:49
Your offset time is: 2024-11-19 23:25:49