• What do you need help with? Version 5
    5,752 replies, posted
  • Avatar of darkrei9n
  • Its alright man, we all have something that makes us stumble. For you its installing the compiler. For me its getting shit to render right. I don't know why but for some reason my program only draws around maybe half of the triangles it should be. Stops around the 32,000th one or so.
  • Avatar of Lord Ned
  • [QUOTE=darkrei9n;35816865]Its alright man, we all have something that makes us stumble. For you its installing the compiler. For me its getting shit to render right. I don't know why but for some reason my program only draws around maybe half of the triangles it should be. Stops around the 32,000th one or so.[/QUOTE] Integer limit?
  • Avatar of darkrei9n
  • [QUOTE=Lord Ned;35817034]Integer limit?[/QUOTE] Figured it out, I was passing the number of faces not the number of integers.
  • Avatar of Gmod4ever
  • Hey guys. So I'll admit I'm fairly fresh with the C++ game, but I'm not sure where the problem is here. Firstly, some background: I am using SFML, and decided that, because the SoundBuffer object in SFML is expensive to instantiate, I want to create a manager to optimize its usage. How this manager will work is I call a "PlaySound" method, with a filepath as an argument, on the manager - the manager will then go through an array of objects it has stored on itself. If there is a SoundBuffer in that array that is tied to that filepath, then it will simply use that buffer, rather than make a new one. If there is no buffer tied to that filepath, then it'll make a buffer for it, store it, and use that buffer. To tie SoundBuffers and filepaths together, I decided to make what I call a ManagerObject_Sound, which, when provided with a filepath, will store that filepath, and then create and store a SoundBuffer for that filepath. Real simple. However, I am having some issues. [b]Firstly[/b], I'm not exactly sure how to handle the sf::SoundBuffer, because the class is such that you can simply do [code]sf::SoundBuffer buffer;[/code] and it'll create the SoundBuffer into the variable "buffer." I have no idea how to create the class in such a way that it can store an object of the type sf::SoundBuffer, because I imagine if I just do something like [code]class ManagerObject_Sound { public: // Define the variables to be used in the constructor sf::SoundBuffer buffer; // Define the constructor ManagerObject_Sound();[/code] then it'll just create a buffer right then and there. [b]Secondly[/b], using the code below, I get compile errors: [code]#include <SFML/Audio.hpp> using namespace std; class ManagerObject_Sound { public: string filepath; sf::SoundBuffer* buffer; ManagerObject_Sound(string); bool IsForFile(string); sf::SoundBuffer* GetSoundBuffer(); } ManagerObject_Sound::ManagerObject_Sound(string fpath) { filepath = fpath; buffer = new sf::SoundBuffer(); if (!buffer.LoadFromFile(fpath)) { // Error loading } } bool ManagerObject_Sound::IsForFile(string fpath) { return (filepath==fpath); } sf::SoundBuffer* ManagerObject_Sound::GetSoundBuffer() { return buffer; }[/code] [code]1>c:\users\jason\documents\visual studio 2008\projects\ragnarok_client\ragnarok_client\manobj_sound.cpp(16) : error C2533: 'ManagerObject_Sound::{ctor}' : constructors not allowed a return type[/code] I don't know why it is thinking I am trying to return something in my constructor, because I am obviously not. Please forgive me if the class is a horrible abomination: I am going off a somewhat-confusing tutorial's example, and I have absolutely no idea what to do with the SoundBuffer, as explained early. A friend of mine suggested to use a pointer (*), but he admitted he's rusty on C++ and isn't sure. Any help for either of these issues would be greatly appreciated.
  • Avatar of darkrei9n
  • Rather than creating a new managerobject_sound for each buffer, you may want to create a vector. So rather than sf::buffer* you would have [code] std::vector<sf::buffer> buffer; [/code] Then setup a function like. [code] void addToBuffer(sf::buffer addBuffer) { buffer.push_back(addBuffer); } [/code] What this does is rather than creating an array of thirty objects, it creates a vector that can be expanded as needed rather than initializing every buffer before its even needed. You can also check if an existing buffer of that type is already in the vector as well. You may want to check with someone smarter than me though.
  • Avatar of Gmod4ever
  • Interesting idea. I'll be sure to look into vectors, and what exactly they are and how they work. Thanks for the suggestion. Any other ideas are welcome, of course. [img]http://dl.dropbox.com/u/8416055/FacepunchEmots/Buddy.gif[/img]
  • Avatar of Red scout?
  • So, I am trying to solve a sprite layering issue in XNA 4.0 I decided the best method of approaching my issue is putting all the instances of the "Window" class in a list called "WindowList" this is to make the layering work properly so that clicking a window will bring it forth. I use an insertion sort loop to put them all in order in the list to draw the deepest one first, and then drawing the second deepest and so on. The problem is that the draw order seems completly fucked in this case. It's pretty much random with both layering and detection of where I click [code] public void SortWindows() { for (int i = 1; i < WindowList.Count; i++) { for (int j = i; j > 0; j--) { if (WindowList[j].WindowLayerDepth > WindowList[j - 1].WindowLayerDepth) { AttractionWindow tmp = WindowList[j - 1]; WindowList[j - 1] = WindowList[j]; WindowList[j] = tmp; } else break; } } }[/code] Is in the Game1 class, calls every loop, will change to only call when needed. [code]protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int i = 0; i < WindowList.Count; i++) { WindowList[i].Draw(spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }[/code] and here's the click detection code [code]if (CurrentmouseState.LeftButton == ButtonState.Pressed && OldMouseState.LeftButton == ButtonState.Released) { bool Invalid = false; int ExcludeWindow = 0; for (int i = 0; i < main.WindowList.Count; i++) { if (main.WindowList[i].rectangle.Intersects(rectanglePoint) && main.WindowList[i].TopWindow == true) { Invalid = true; break; } } if (!Invalid) { for (int i = 0; i < main.WindowList.Count; i++) { if (main.WindowList[i].rectangle.Intersects(rectanglePoint)) { main.WindowList[i].surfaceWindow(); main.WindowList[i].TopWindow = true; ExcludeWindow = i; break; } } { for (int i = 0; i < main.WindowList.Count; i++) { if (i != ExcludeWindow) { main.WindowList[i].TopWindow = false; } } } } }[/code]
  • Avatar of Jimbomcb
  • so... I have a file I need to decompress [url]http://dl.dropbox.com/u/1032139/token[/url] I know it's compressed using some method, I was assuming zlib but nothing seemed to work. am I missing something, is there some tell-tale way to work out what way it's compressed or am I out of luck.
  • Avatar of krassell
  • I need real quick way to write symbol-by-symbol to the console. putchar() takes shameful amount of time to fill 80*50. I don't really care how hacky it will be, speed is what matters. Oh also, that is, in C++.
  • Avatar of Protocol7
  • [QUOTE=Gmod4ever;35819192]Interesting idea. I'll be sure to look into vectors, and what exactly they are and how they work. Thanks for the suggestion. Any other ideas are welcome, of course. [img]http://dl.dropbox.com/u/8416055/FacepunchEmots/Buddy.gif[/img][/QUOTE] Vectors are fantastic. They're STL containers (standard template library). Templates basically mean that you can define one class or function, use templates and every time you invoke it, you can set the data type it will handle. That's why when darkrei9n did [cpp]std::vector<sf::SoundBuffer> buffer;[/cpp] You see the SoundBuffer in the angle brackets; that's instantiating a vector container that stores objects of type SoundBuffer. Which is, from what I gather, what you want to do.
  • Avatar of Chryseus
  • [cpp]import pyglet from pyglet.gl import * import math class Camera(object): def __init__(self): self.x = 0 self.y = 0 self.z = 0 self.rotx = 0 self.roty = 0 self.rotz = 0 class Game(pyglet.window.Window): def __init__(self): super(Game, self).__init__() self.setupViewport(60, 0.1, 1000) glEnable(GL_POINT_SMOOTH) glPointSize(2.0) def on_draw(self): glLoadIdentity() gluLookAt(0,0,-10,0,0,0,0,1,0) glBegin(GL_POINTS) glColor3f(1.0,0,0) glVertex3f(0,0,0) glEnd() glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) self.clear() def drawCube(self, x, y, width, height, style): glBegin(GL_QUADS) glColor3f(1.0,0,0) glVertex3f(-1.0,-1.0,0) # TL glVertex3f(-1.0,-1.0,-1.0) # TLB glVertex3f(1.0,-1.0,0) # TR glVertex3f(1.0,-1.0,-1.0) # TRB glColor3f(0,1.0,0) glVertex3f(-1.0,-1.0,-1.0) # BTL glVertex3f(1.0,-1.0,-1.0) # BTR glVertex3f(1.0,1.0,-1.0) # BBR glVertex3f(-1.0,1.0,-1.0) # BBL glEnd() def setupViewport(self, fov, nearclip, farclip): aspect = self.width / self.height glViewport(0,0,self.width,self.height) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(80,aspect,nearclip,farclip) glMatrixMode(GL_MODELVIEW) g = Game() pyglet.app.run()[/cpp] It worked fine with a plain old orthographic projection matrix but now that I've switched it to perspective I can't see anything, it's driving me mad. [b]Never mind I fixed it, had to override the on_resize event[/b]
  • Avatar of Mordi
  • I need some help determining 2D texture-coordinates. I've got a big spritefont-texture, and I want to get the coordinates of a single character. I have saved the x/y-offsets of each character in pixels, and I also have the width. What I have tried is diving these by the width and height of the spritefont and using this as the coordinates, but this did not seem to work. Am I doing something else wrong, or is my math off here? Edit: Nevermind, I figured it out. I was casting wrongly.
  • Avatar of HeatPipe
  • Hello. How can I make one additional reference of one class datatype pointing to existing object? Like, I have two references in stack pointing into one single object in the heap?
  • Avatar of Protocol7
  • [QUOTE=HeatPipe;35827415]Hello. How can I make one additional reference of one class datatype pointing to existing object? Like, I have two references in stack pointing into one single object in the heap?[/QUOTE] Wouldn't that just be two pointers? Just declare two stack pointers with the address of the heap object. I think.
  • Avatar of ShaunOfTheLive
  • [QUOTE=Jimbomcb;35820481]so... I have a file I need to decompress [url]http://dl.dropbox.com/u/1032139/token[/url] I know it's compressed using some method, I was assuming zlib but nothing seemed to work. am I missing something, is there some tell-tale way to work out what way it's compressed or am I out of luck.[/QUOTE] I'll try to figure it out, but it better not be a virus (I got ass fucked before by a virus from here and almost lost my FP account) EDIT: it doesn't have any recognizable header or anything distinguishing it from random data... sorry bro can't help
  • Avatar of raccoon12
  • Help [quote]1>------ Build started: Project: TerrainGeneration, Configuration: Debug Win32 ------ 1> main.cpp 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\terrainwindow.hpp(33): warning C4018: '<=' : signed/unsigned mismatch 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3): error C2011: 'Entity' : 'class' type redefinition 1> r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3) : see declaration of 'Entity' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(11): error C2027: use of undefined type 'Entity' 1> r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3) : see declaration of 'Entity' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(13): error C2065: 'texture' : undeclared identifier 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(13): error C2228: left of '.loadFromFile' must have class/struct/union 1> type is ''unknown-type'' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2355: 'this' : can only be referenced inside non-static member functions 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2227: left of '->setTexture' must point to class/struct/union/generic type 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2065: 'texture' : undeclared identifier 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(8): error C2079: 'ent' uses undefined class 'Entity' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(8): error C2079: 'ent2' uses undefined class 'Entity' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(9): error C2228: left of '.textureInit' must have class/struct/union 1> type is 'int' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(10): error C2228: left of '.setPosition' must have class/struct/union 1> type is 'int' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(12): error C2228: left of '.textureInit' must have class/struct/union 1> type is 'int' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(13): error C2228: left of '.setPosition' must have class/struct/union 1> type is 'int' 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(15): error C2664: 'TerrainWindow::AddDrawableToVector' : cannot convert parameter 1 from 'int' to 'Entity' 1> Source or target has incomplete type 1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(16): error C2664: 'TerrainWindow::AddDrawableToVector' : cannot convert parameter 1 from 'int' to 'Entity' 1> Source or target has incomplete type ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== [/quote] main.cpp [code] #include "TerrainWindow.hpp" #include "Entity.hpp" int main() { TerrainWindow wnd; wnd.CreateTerrainWindow(800, 600, 32, "Test of SFML Engine"); Entity ent, ent2; ent.textureInit("dot.png"); ent.setPosition(10.0f, 10.0f); ent2.textureInit("dot.png"); ent2.setPosition(100.0f, 100.0f); wnd.AddDrawableToVector(ent); wnd.AddDrawableToVector(ent2); wnd.TerrainWindowLoop(); } // [/code] TerrainWIndow.hpp [code]#include "BasicInclude.h" #include "Entity.hpp" class TerrainWindow { // terrain window public: void CreateTerrainWindow(int width, int height, int bits, std::string title); // sf::RenderWindow GetTerrainWindow(); void TerrainWindowLoop(); // bool GetState(); // void SetState(bool running); void CreateSinWave(); void AddDrawableToVector(Entity newDrawable); void Draw(); protected: sf::RenderWindow Wnd; // bool isRunning; // sf::Sprite sinWave; std::vector<Entity> sprites; }; void TerrainWindow::CreateTerrainWindow(int width, int height, int bits, std::string title) { Wnd.create(sf::VideoMode(width, height, bits), title); } void TerrainWindow::AddDrawableToVector(Entity newDrawable) { sprites.push_back(newDrawable); } void TerrainWindow::Draw() { for(int i = 0; i <= sprites.size(); i++) { Wnd.draw(sprites.at(i)); std::cout << i << "\n"; std::cout << sprites.size(); } } void TerrainWindow::TerrainWindowLoop() { while(Wnd.isOpen()) { sf::Event events; while (Wnd.pollEvent(events)) { if (events.type == sf::Event::Closed) Wnd.close(); } Wnd.clear(); TerrainWindow::Draw(); Wnd.display(); } } [/code] Entity.hpp [code] #include "BasicInclude.h" class Entity : public sf::Sprite { public: void textureInit(std::string file); private: sf::Texture texture; }; void Entity::textureInit(std::string file) { if(!texture.loadFromFile(file)) { std::cout << "Error opening " << file << "\n"; } else { this->setTexture(texture); } }[/code]
  • Avatar of Lord Ned
  • [QUOTE=darkrei9n;35829231]Trying to generate indices for a cube, anyone know any equations?[/QUOTE] Do it by hand in your head? [cpp] DebugVertex_t cubeVerts[] = { //POSITION - TOP {glm::vec3(vecMin.x, vecMax.y, vecMin.y), color}, //LEFT BACK {glm::vec3(vecMax.x, vecMax.y, vecMin.y), color}, //RIGHT BACK {glm::vec3(vecMin.x, vecMax.y, vecMax.y), color}, //LEFT FRONT {glm::vec3(vecMax.x, vecMax.y, vecMax.y), color}, //RIGHT FRONT //POSITION - BOTTOM {glm::vec3(vecMin.x, vecMin.y, vecMin.y), color}, //LEFT BACK {glm::vec3(vecMax.x, vecMin.y, vecMin.y), color}, //RIGHT BACK {glm::vec3(vecMin.x, vecMin.y, vecMax.y), color}, //LEFT FRONT {glm::vec3(vecMax.x, vecMin.y, vecMax.y), color}, //RIGHT FRONT }; //Create some Indexes unsigned int crossIndexes[] = { //TOP 0, 1, 2, 3, 0, 2, 1, 3, //BOTTOM 4, 5, 6, 7, 4, 6, 5, 7, //SIDES 0, 4, 1, 5, 2, 6, 3, 7, }; m_iIndexCount = 24; [/cpp]
  • Avatar of darkrei9n
  • [QUOTE=Lord Ned;35829584]Do it by hand in your head? [cpp] DebugVertex_t cubeVerts[] = { //POSITION - TOP {glm::vec3(vecMin.x, vecMax.y, vecMin.y), color}, //LEFT BACK {glm::vec3(vecMax.x, vecMax.y, vecMin.y), color}, //RIGHT BACK {glm::vec3(vecMin.x, vecMax.y, vecMax.y), color}, //LEFT FRONT {glm::vec3(vecMax.x, vecMax.y, vecMax.y), color}, //RIGHT FRONT //POSITION - BOTTOM {glm::vec3(vecMin.x, vecMin.y, vecMin.y), color}, //LEFT BACK {glm::vec3(vecMax.x, vecMin.y, vecMin.y), color}, //RIGHT BACK {glm::vec3(vecMin.x, vecMin.y, vecMax.y), color}, //LEFT FRONT {glm::vec3(vecMax.x, vecMin.y, vecMax.y), color}, //RIGHT FRONT }; //Create some Indexes unsigned int crossIndexes[] = { //TOP 0, 1, 2, 3, 0, 2, 1, 3, //BOTTOM 4, 5, 6, 7, 4, 6, 5, 7, //SIDES 0, 4, 1, 5, 2, 6, 3, 7, }; m_iIndexCount = 24; [/cpp][/QUOTE] Need to be able to do it for any size cube. Essentially setting up a function to create a cube that can be any size depending on arguments.
  • Avatar of Lord Ned
  • [QUOTE=darkrei9n;35829706]Need to be able to do it for any size cube. Essentially setting up a function to create a cube that can be any size depending on arguments.[/QUOTE] Indexes don't change. Either way the code above should get you a cube that's the size of the mins/maxs.
  • Avatar of darkrei9n
  • [QUOTE=Lord Ned;35829767]Indexes don't change. Either way the code above should get you a cube that's the size of the mins/maxs.[/QUOTE] As in a 4x4x4 vertex cube or a 2x2x2 vertex cube. So the indices do change in this case.
  • Avatar of swift and shift
  • [QUOTE=krassell;35823832]I need real quick way to write symbol-by-symbol to the console. putchar() takes shameful amount of time to fill 80*50. I don't really care how hacky it will be, speed is what matters. Oh also, that is, in C++.[/QUOTE] [cpp] char buff[80*50]; memset(buff, 'X', sizeof(buff)); write(1, buff, sizeof(buff)); [/cpp]
  • Avatar of Jookia
  • [QUOTE=krassell;35823832]I need real quick way to write symbol-by-symbol to the console. putchar() takes shameful amount of time to fill 80*50. I don't really care how hacky it will be, speed is what matters. Oh also, that is, in C++.[/QUOTE] Curses.
  • Avatar of Gmod4ever
  • Hey guys. I solved my compile issues (turns out you need a ";" after the "}" when declaring a class...), and I think I've managed to figure out how I want to make my manager object. However, I now have a new issue. The object class I made is, as before, called [b]ManagerObject_Sound[/b]. In my manager class, which is [b]Manager_Sound[/b], I decided to use a vector, since darkrei9n brought them to my attention and they sound awesome. Using the generic form of "std::vector<DATA TYPE> VARNAME;", I do such: [code] class Manager_Sound { public: std::vector<ManagerObject_Sound> ObjectVector; Manager_Sound(); };[/code] However, doing so, I get this error: [code]1>c:\users\jason\documents\visual studio 2008\projects\ragnarok_client\ragnarok_client\manager_sound.cpp(8) : error C2065: 'ManagerObject_Sound' : undeclared identifier[/code] I've replaced the "ManagerObject_Sound" in that vector declaration with "int," and it works fine, so it's not the vector. Any ideas? Google didn't bring up much for me.
  • Seems to me that the compiler cannot find your datatype for ManagerObject_Sound. Did you include it?
  • Avatar of Gmod4ever
  • [QUOTE=Topgamer7;35830234]Seems to me that the compiler cannot find your datatype for ManagerObject_Sound. Did you include it?[/QUOTE] Do I need to? :v: The file's name is "manobj_sound.cpp". I just tried simply doing "include <manobj_sound>", but it says it can't include manobj_sound. Forgive the newbiness / stupidity, but the tutorials I've seen about classes all seem to be pretty hazy about this stuff, so I really don't know about this, and I don't really have any friends that can help me out much here, so you guys are my only hope when Google turns up nothing that I find very useful.
  • Avatar of darkrei9n
  • [QUOTE=Gmod4ever;35830277]Do I need to? :v: The file's name is "manobj_sound.cpp". I just tried simply doing "include <manobj_sound>", but it says it can't include manobj_sound. Forgive the newbiness / stupidity, but the tutorials I've seen about classes all seem to be pretty hazy about this stuff, so I really don't know about this, and I don't really have any friends that can help me out much here, so you guys are my only hope when Google turns up nothing that I find very useful.[/QUOTE] #include only includes the file for that file that calls it along with any files called by the file you just included. Let me show you the hierarchy for my project, might help you understand #include better. Okay nevermind, VS11 doesn't want to generate the graph of my include files. Think about it like a hirearchy. Main could include <iostream> and you could have two headers include main, but as far as those two files are concerned unless you include the other they don't exist. Anything that main included they acknowledge but nothing else.
  • #include <ashdasd> is different from #include "askjdfasd" See here: [url]http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename[/url] You would need to do #include "manobj_sound.cpp", and typically you would want to do the header file instead. As a side note, [url]http://cplusplus.com[/url] is great for language and function reference.
  • Avatar of Gmod4ever
  • [QUOTE=Topgamer7;35830344]#include <ashdasd> is different from #include "askjdfasd" See here: [url]http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename[/url] You would need to do #include "manobj_sound.cpp", and typically you would want to do the header file instead. As a side note, [url]http://cplusplus.com[/url] is great for language and function reference.[/QUOTE] [del]Fair enough. My object doesn't have a header, though. Should I make it one, and if so, what all should be in it? Also, doing [i]#include "manobj_sound.cpp"[/i] in the file for for my manager alleviated that issue, but now I have a new issue: [code]1>manobj_sound.obj : error LNK2005: "public: __thiscall ManagerObject_Sound::ManagerObject_Sound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0ManagerObject_Sound@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in manager_sound.obj 1>manobj_sound.obj : error LNK2005: "public: class sf::SoundBuffer __thiscall ManagerObject_Sound::GetBuffer(void)" (?GetBuffer@ManagerObject_Sound@@QAE?AVSoundBuffer@sf@@XZ) already defined in manager_sound.obj 1>manobj_sound.obj : error LNK2005: "public: bool __thiscall ManagerObject_Sound::IsCorrectBuffer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?IsCorrectBuffer@ManagerObject_Sound@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in manager_sound.obj[/code] And I have no idea what that means. I see it's referring to the functions in my ManagerObject_Sound, though, whose code is as thus: [code]#include <SFML/Audio.hpp> using namespace std; class ManagerObject_Sound { public: string filepath; sf::SoundBuffer buffer; ManagerObject_Sound(string); sf::SoundBuffer GetBuffer(); bool IsCorrectBuffer(string); }; ManagerObject_Sound::ManagerObject_Sound(string fpath) { filepath = fpath; buffer.LoadFromFile(fpath); }; sf::SoundBuffer ManagerObject_Sound::GetBuffer() { return buffer; }; bool ManagerObject_Sound::IsCorrectBuffer(string fpath) { return (filepath==fpath); };[/code][/del] Nevermind, I figured it out. I'm glad I downloaded the source code for the open-source Roguelike "Cataclysm" (had to recompile it myself, with a provided hotfix), because I just looked at how they handle .cpp's and .h's. That stackoverflow thread you linked me to helped as well, with the examples posted in it. Thanks a lot guys. [editline]Fish[/editline] [QUOTE=Topgamer7;35830791]in your header you should have [code]class ManagerObject_Sound { public: string filepath; sf::SoundBuffer buffer; ManagerObject_Sound(string); sf::SoundBuffer GetBuffer(); bool IsCorrectBuffer(string); };[/code] and in your class file [code]ManagerObject_Sound::ManagerObject_Sound(string fpath) { filepath = fpath; buffer.LoadFromFile(fpath); }; sf::SoundBuffer ManagerObject_Sound::GetBuffer() { return buffer; }; bool ManagerObject_Sound::IsCorrectBuffer(string fpath) { return (filepath==fpath); };[/code] I suggest you read through the language tutorial on [url]http://cplusplus.com[/url]. It will help with these problems, and give you the knowledge to fix some problems you may come up with soon. Don't forget to include the header file in your class definition. And include your header instead of the class file in your other files. And also you don't need the using namespace std; if you aren't going to use code from the standard library. Typically its just a good idea to access the namespace with the modifier std::[/QUOTE] Yeah, I went through the entirety of the tutorial on that site (that's where I started), and it doesn't really explain any of this stuff that well at all. Trust me, I've looked at it enough times. I already established that, as you can see in my post edit - having actual source code to reference helps me a lot in these things. And I know about needing to use the std namespace, and how it's generally better to prefix things with std:: - the only reason that's there is legacy code when I was trying to figure out what was going wrong with the vector thing. Like I said, though, I've got it all figured out. Thanks a lot.