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 / Vector errors?

Author
Message
Kaz3
15
Years of Service
User Offline
Joined: 15th Sep 2009
Location: New York
Posted: 21st Sep 2009 07:26
I needed a way to control all bullets on screen at once so I searched and I found something about vectors(let me know if there's a better way). I decided to use them so I started learning about them.

So to construct the vector I did this:
vector<int> bullet(20);

But when I go to compile it, I get this error:
libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

Along with 3 unresolved external errors. Can someone tell me why and how to fix it?
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 21st Sep 2009 15:35
change the library type you are linking to from "Multithreaded Debug", to "Multithreaded" .

You will also need to either have a "using namespace std;" decleration in your code, or you will have to qualify the "vector" class with it's namespace scope "std::vector<int> bullet(20);"

If it ain't broke.... DONT FIX IT !!!
Kaz3
15
Years of Service
User Offline
Joined: 15th Sep 2009
Location: New York
Posted: 21st Sep 2009 17:28
Where would I change that? I haven't worked with VC++ much before this =/
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 21st Sep 2009 20:32
Project properties; configuration properties; C/C++; Code generation.
Kaz3
15
Years of Service
User Offline
Joined: 15th Sep 2009
Location: New York
Posted: 21st Sep 2009 20:55 Edited at: 21st Sep 2009 21:13
It is already set to that.

And yes I'm using the namespace.
Kaz3
15
Years of Service
User Offline
Joined: 15th Sep 2009
Location: New York
Posted: 23rd Sep 2009 06:10
I have gotten over that error and am now running into a new one. I am using some code that Mista Wilson posted in http://forum.thegamecreators.com/?m=forum_view&t=156784&b=22




Creating the bullets:


I receive this error upon compile:
error C2664: 'std::vector<_Ty>::push_back' : cannot convert parameter 1 from 'const int' to 'const BULLET &'
1> with
1> [
1> _Ty=BULLET
1> ]
1> Reason: cannot convert from 'const int' to 'const BULLET'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 26th Sep 2009 15:44 Edited at: 26th Sep 2009 15:44
In Mista's code there were brackets after the BULLET (calling the "constructor") which are missing from your version. Try adding them:



I get a different error message when compiling without the brackets, but it compiles with them.

Login to post a reply

Server time is: 2024-10-01 14:24:01
Your offset time is: 2024-10-01 14:24:01