Comments (13)
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.
Thanks. Now I am getting the error "undefined reference to 'sfg::SFGUI::SFGUI()'
from sfgui.
What is your verbose build output? https://www.sfml-dev.org/faq.php#tr-grl-verbose-ide
from sfgui.
-------------- 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.
You aren't linking SFGUI (-lsfgui
)
Also be careful with building stuff within OneDrive, sometimes the sync can lock stuff.
from sfgui.
-------------- 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.
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.
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.
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.
Ok, so I've done some reinstalling.
- I uninstalled codeblocks-mingw (I was having some issues with the compiler included in that version)
- I installed mingw on it's on and added it's bin directory to the path.
- I reinstalled the basic codeblocks setup.
- I removed my previous SFML version.
- I downloaded the latest source code for SFML and built it statically.
- I downloaded the latest source code for SFGUI and build it statically.
- 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
from sfgui.
In the linker settings you're not linking SFGUI.
from sfgui.
@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.
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)
- Can't expand ScrolledWindow children
- No obvious way to prevent window dragging. HOT 2
- sfgui apps crash immediately HOT 9
- Errors while batch build HOT 2
- Better integration in modern workflow HOT 4
- Font doesn't render properly HOT 4
- Update include/SFGUI/Config.hpp Version Information HOT 1
- Clipboard support HOT 1
- Undefined reference while trying to static linking with mingw32 HOT 1
- Sample projects crash when run in debug on Windows HOT 4
- Can't build on macOS 10.15 HOT 1
- Global state HOT 4
- Create The Style Reference
- How can I set the size of a widget or of a button? HOT 1
- Examples are miniature on Mac OS (Retina) HOT 2
- Password cursor moves away from current typing point HOT 2
- feature request: color picker
- Naming of engine's source files
- Problem on RenderBatch.hpp could not be found!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfgui.