Git Product home page Git Product logo

Comments (13)

Kostu96 avatar Kostu96 commented on May 30, 2024

If you have this error that means you link agains dynamic sfgui, you have link against sfgui-s.lib and define SFGUI_STATIC in preprocesor. It's very similar to linking sfml staticly

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

Thanks. Now I am getting the error "undefined reference to 'sfg::SFGUI::SFGUI()'

from sfgui.

eXpl0it3r avatar eXpl0it3r commented on May 30, 2024

What is your verbose build output? https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

-------------- Build: Debug in SFML Maze Solver (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib" -L"C:\Program Files (x86)\CodeBlocks\SFML-2.4.2\lib" -o bin\Debug\ConwaysGameOfLife.exe obj\Debug\main.o obj\Debug\src\Application.o -lsfml-graphics -lsfml-window -lsfml-system
obj\Debug\main.o: In function main': C:/Users/james/OneDrive/Documents/dev/C++/Maze Solver SFML/main.cpp:16: undefined reference to _imp___ZN3sfg5SFGUIC1Ev'
C:/Users/james/OneDrive/Documents/dev/C++/Maze Solver SFML/main.cpp:16: undefined reference to `_imp___ZN3sfg5SFGUID1Ev'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Tried to recreate the error from before (I didn't save and I closed down codeblocks, which may have reset some settings) and now I'm getting a new error. Apologies for being stupid

from sfgui.

eXpl0it3r avatar eXpl0it3r commented on May 30, 2024

You aren't linking SFGUI (-lsfgui)

Also be careful with building stuff within OneDrive, sometimes the sync can lock stuff.

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

-------------- Build: Debug in SFML Maze Solver (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -DSFGUI_STATIC -std=c++11 -g -std=c++11 -g -Iinclude -I"C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\include" -I"C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\include" -I"C:\Program Files (x86)\CodeBlocks\SFML-2.4.2\include" -c "C:\Users\james\OneDrive\Documents\dev\C++\Maze Solver SFML\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib" -L"C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib" -L"C:\Program Files (x86)\CodeBlocks\SFML-2.4.2\lib" -o bin\Debug\ConwaysGameOfLife.exe obj\Debug\main.o obj\Debug\src\Application.o "C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a" -lsfml-graphics -lsfml-window -lsfml-system
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(SFGUI.cpp.obj):SFGUI.cpp:(.eh_frame+0x43): undefined reference to __gxx_personality_v0' C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x2ac): undefined reference to _Unwind_Resume'
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0xec5): undefined reference to _Unwind_Resume' C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0xedb): undefined reference to _Unwind_Resume'
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x10e8): undefined reference to _Unwind_Resume' C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x20d6): undefined reference to _Unwind_Resume'
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x20f8): more undefined references to _Unwind_Resume' follow C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x3afc): undefined reference to sf::String::beginabi:cxx11 const'
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x3b09): undefined reference to sf::String::end[abi:cxx11]() const' C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x3f60): undefined reference to _Unwind_Resume'
C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x3f7a): undefined reference to _Unwind_Resume' C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj):Renderer.cpp:(.text+0x3fd0): undefined reference to _Unwind_Resume'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: C:\Program Files (x86)\CodeBlocks\SFGUI-0.3.2\lib\libsfgui-s.a(Renderer.cpp.obj): bad reloc address 0x7 in section `.text$_ZNSt23_Sp_counted_ptr_inplaceIN3sfg16RendererViewportESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED0Ev[__ZNSt23_Sp_counted_ptr_inplaceIN3sfg16RendererViewportESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED0Ev]'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
13 error(s), 0 warning(s) (0 minute(s), 2 second(s))

I've relinked everything (using this except for SFGUI) and this is the never verbose output.

from sfgui.

eXpl0it3r avatar eXpl0it3r commented on May 30, 2024

Personally, I'd strongly recommend to not mix static and dynamic libraries, unless you really know what you're doing. As such I'd recommend to link SFGUI dynamically (without -s suffix) as well.

There however still might be the chance, that SFML and SFGUI weren't built with the same compiler, which can lead to incompatibilities with the runtime.

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

I have no idea what I'm doing, maybe I should just move on :(. Thanks for the help though, I'll hopefully get it working some day

from sfgui.

DrBarbare avatar DrBarbare commented on May 30, 2024

Hi there,

I recommend trusting in CMake. Also using all static version of SFML, SFGUI and all other external dependencies you have.

First of all, why static libraries (aka .lib)? Because dynamic library loading on Windows is a mess. Really. Here is the doc that "explains" it. Now, I come from Linux dev, and I happen to have started developing on windows to make sure I was not breaking this project with my CMake changes.... 😊. So I am a bit biased there. When you link against static libraries, the compiler makes sure all the code you need is in your target, no missing symbols at runtime!

Second, I would recommend using CMake's CodeBlock generator. It should generate a usable project in your build directory... but you can also use CMake directly to build with cmale --build <build_dir>. For example, on my Windows box I only have Visual Studio 15 2017, I use CMake generator to configure my project (I make sure all my projects use the same generator BTW). And then, I just use the build command above to compile. I haven't opened VS once.

Now you last error seems to be due to incompatible ABIs. I would try upgrading to latest version of SFGUI and SFML (0.4.0 and 2.5.1) and try again.

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

Ok, so I've done some reinstalling.

  1. I uninstalled codeblocks-mingw (I was having some issues with the compiler included in that version)
  2. I installed mingw on it's on and added it's bin directory to the path.
  3. I reinstalled the basic codeblocks setup.
  4. I removed my previous SFML version.
  5. I downloaded the latest source code for SFML and built it statically.
  6. I downloaded the latest source code for SFGUI and build it statically.
  7. I followed the steps here to try and use sfml on codeblocks.

The following is an image of my linker settings and the error message I get when I compile my SFML program
image

from sfgui.

eXpl0it3r avatar eXpl0it3r commented on May 30, 2024

In the linker settings you're not linking SFGUI.

from sfgui.

James-Aylward avatar James-Aylward commented on May 30, 2024

@eXpl0it3r I know, I uninstalled everything to start new and now I'm currently trying to get SFML working before SFGUI. I'll probably hop over to the SFML forums if this isn't the place to fix a (hopefully) quick SFML error.

from sfgui.

eXpl0it3r avatar eXpl0it3r commented on May 30, 2024

Looks like you added C:\SFML\lib\sfml-xyz-s.a to the general project settings, but also added -lsfml-xyz to the Release specific project settings.

If you want the dependencies listed in the general project settings, you need to make sure, that they are appended to the target specific project settings.

from sfgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.