• What do you need help with? Version 5
    5,752 replies, posted
that was remnants of old code when MenuItem was in Text, thanks though cleaning code is always good [editline]3rd February 2013[/editline] please
Copy your code base, remove as much as you can without having it stop erroring, then paste what you have left. You should have like one trouble file.
Or if you're using git, you could [url=http://git-scm.com/book/en/Git-Tools-Debugging-with-Git#Binary-Search]bisect[/url] and see which commit introduced the bug. But you aren't, are you
[QUOTE=Asgard;39463472]I've looked through the entire $ cmake --trace output, and I am sure everything is found and linked correctly. What is going wrong? [editline]3rd February 2013[/editline] objdump just informed me that the architecture of the .so files are exactly the same, so it most likely isn't that either. I'm about ready to kill myself.[/QUOTE] Use FindSDL, not FindSDL2.
[QUOTE=esalaka;39465620]Or if you're using git, you could [url=http://git-scm.com/book/en/Git-Tools-Debugging-with-Git#Binary-Search]bisect[/url] and see which commit introduced the bug. But you aren't, are you[/QUOTE] [url]https://github.com/Tetramputechture/Yttra[/url] hasn't been updated in a while because this function has been a bitch to implement [editline]4th February 2013[/editline] [QUOTE=Jookia;39465595]Copy your code base, remove as much as you can without having it stop erroring, then paste what you have left. You should have like one trouble file.[/QUOTE] I don't see how it could be that complex though? It just doesn't see that Text is a type specifier. [editline]4th February 2013[/editline] Text.h also has #include <Source/Menu/MainMenu.h> So MainMenu.h includes Text.h and Text.h includes MainMenu.h Is that bad?
[QUOTE=Meatpuppet;39465805] Text.h also has #include <Source/Menu/MainMenu.h> So MainMenu.h includes Text.h and Text.h includes MainMenu.h Is that bad?[/QUOTE] -snip Whoops, yes it can be- [cpp] -- A.hpp #include "B.hpp" class A { public: B var; }; -- B.hpp #include "A.hpp class B { public: A var; }; [/cpp] Should be something like this [cpp] -- A.hpp class B; class A { public: B var; }; -- B.hpp #include "A.hpp" class B { public: A var; }; [/cpp]
Ok, so that's not the problem. I wonder why it's not detecting Text as a type specifier?
[QUOTE=Meatpuppet;39466040]Ok, so that's not the problem. I wonder why it's not detecting Text as a type specifier?[/QUOTE] It can be bad, yes. I updated my post.
[QUOTE=Meatpuppet;39466040]Ok, so that's not the problem. I wonder why it's not detecting Text as a type specifier?[/QUOTE] If you're concerned, use forward declaration. Put class Text; class MenuResult; //or whatever Before your proper class blocks.
that didn't fix it :( [editline]4th February 2013[/editline] this seems so simple aaaaa
Commit all your changes to git and just put "BROKEN" at the start of the commit message, or use a branch, so we can see the full code and work out why it's not working for you. what's the full output from the compiler?
Full compiler output: [cpp]Error 1 error C2146: syntax error : missing ';' before identifier 'text' Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 3 error C2061: syntax error : identifier 'Text' [/cpp] [editline]4th February 2013[/editline] [url]https://github.com/Tetramputechture/Yttra[/url]
[QUOTE=Meatpuppet;39466429]Full compiler output: [cpp]Error 1 error C2146: syntax error : missing ';' before identifier 'text' Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Error 3 error C2061: syntax error : identifier 'Text' [/cpp] [editline]4th February 2013[/editline] [url]https://github.com/Tetramputechture/Yttra[/url][/QUOTE] your compiler doesn't even tell you the files or lines where the errors are coming from?
the lines are 16 for the first two and 18 for the last
right, and the file in particular is...
mainmenu.h
You're not actually using the Menu class in Text.h at all. Remove that include. I suspect your problem is to do with your circular #include . MainMenu.h requires 'Text' to be defined, but if you've #included files in the wrong order then Text will be defined after Menu, which will break compilation. You can't use a forward-declaration to solve the issue as Text is a straight member of MenuItem (as opposed to a pointer or reference). Try removing the MainMenu.h #include statement in Text.h and see what happens. [editline]4th February 2013[/editline] I'd suggest you change all of your #pragma once include guards back into #ifndef SOMETHING_UNIQUE guards.
two more errors arise from doing that [cpp]Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Font const & __cdecl sf::Text::getFont(void)const " (__imp_?getFont@Text@sf@@QEBAAEBVFont@2@XZ) referenced in function "public: class sf::Font __cdecl Text::getFont(void)" (?getFont@Text@@QEAA?AVFont@sf@@XZ) C:\Facepunch Pacman Project\Faceman\Text.obj Faceman Error 5 error LNK2001: unresolved external symbol "private: static class sf::Text Text::text" (?text@Text@@0V1sf@@A) C:\Facepunch Pacman Project\Faceman\Text.obj Faceman [/cpp]
that's a kinda good sign, it means we've passed compilation and now we're failing to link. You can fix that second error ("Error 5" in your quote) by putting sf::Text Text::text; after #include Text.h in Text.cpp The first error I'm not so sure about - it looks to me like a problem within SFML. Are you linking to all of the SFML libraries correctly and in the right order?
ok that fixed the second error... only one more! let me check... I don't see why this would be popping up now as the text class worked before just without the highlighting function [editline]4th February 2013[/editline] I commented out the getFont function, now it compiles, but sadly my highlight outline fucntion is not working [editline]4th February 2013[/editline] and my game states are fucking up. like, what the hell, the escape button is being really fucking weird when i click on start. why can't i get anything to FUCKING WORK
The compiler is trying to find an instance of the static class 'text' your defined in Text.h. Remove that, and the static methods. Or initialize text. Edit: Ninja'd.
Snip fixed [editline]4th February 2013[/editline] It always seems that as soon as I ask the question the answer dawns upon me.. Not such a bad thing, though it means I end up asking lots of pointless questions :v:
[QUOTE=Jookia;39465622]Use FindSDL, not FindSDL2.[/QUOTE] As I said, it was able to find the libraries and include files just fine. Or are you saying I should use 1.2 and not 2.0? [editline]4th February 2013[/editline] Would it matter that the SDL2 include files are in /usr/include/ and the SDL_TTF include files are in /usr/local/include/ [editline]4th February 2013[/editline] or /usr/lib/x86_64-linux-gnu/libSDL_ttf.so and /usr/lib/libSDL2.so
[QUOTE=Asgard;39469131]As I said, it was able to find the libraries and include files just fine. Or are you saying I should use 1.2 and not 2.0? [editline]4th February 2013[/editline] Would it matter that the SDL2 include files are in /usr/include/ and the SDL_TTF include files are in /usr/local/include/ [editline]4th February 2013[/editline] or /usr/lib/x86_64-linux-gnu/libSDL_ttf.so and /usr/lib/libSDL2.so[/QUOTE] I use SDL 2 + CMake with it installed in /home/jookia/Programming/local. I have to manually specify the libraries so CMake can use them, but it works.
[QUOTE=Asgard;39469131]As I said, it was able to find the libraries and include files just fine. Or are you saying I should use 1.2 and not 2.0? [editline]4th February 2013[/editline] Would it matter that the SDL2 include files are in /usr/include/ and the SDL_TTF include files are in /usr/local/include/ [editline]4th February 2013[/editline] or /usr/lib/x86_64-linux-gnu/libSDL_ttf.so and /usr/lib/libSDL2.so[/QUOTE] Not if you include both directories. Like this: [code]-I /usr/local/include/ -I /usr/include[/code]
[QUOTE=Jookia;39469260]I use SDL 2 + CMake with it installed in /home/jookia/Programming/local. I have to manually specify the libraries so CMake can use them, but it works.[/QUOTE] The thing is, that when I message() the variables used to link the libraries and add the include directories, the paths appear just fine. FindSDL2.cmake and FindSDL_TTF.cmake can find them perfectly. I checked the architecture of both SDL2 and the SDL_TTF lib files, and they're both the same. I'm honestly out of options on what it could be. [editline]4th February 2013[/editline] Could I take a look at your CMakeLists.txt?
I assume you've compiled + installed + set CMake to use SDL_ttf 2?
[QUOTE=Gulen;39469281]Not if you include both directories. Like this: [code]-I /usr/local/include/ -I /usr/include[/code][/QUOTE] That'd be if I was typing out my own g++ command, but I'm using a CMake file. [editline]4th February 2013[/editline] [QUOTE=Jookia;39469462]I assume you've compiled + installed + set CMake to use SDL_ttf 2?[/QUOTE] Yes
[QUOTE=Meatpuppet;39462870]Holy fuck I've got it down to only two errors. Menu.h The error is occuring on the line Text text;[/QUOTE] Why do you have the "public" visibility modifier in the struct? I'm willing to guess that'll cause an issue. [b]edit:[/b] this maybe useless because i missed a page.
[QUOTE=Asgard;39469463]Yes[/QUOTE] Did you specifically set CMake to use the SDL_ttf 2 libraries?
Sorry, you need to Log In to post a reply to this thread.