I have tried new blank project in Codeblocks and with #include <SFML/Grahpics/CircleShape.hpp>
and just declaring sf::CircleShape and there is no problem.
As soon as I put 2 new files into the project, there is a problem.
I have attached both files but I cannot see any issue with it.
There is not many usage of sf::CircleShape in the files:
Voronoi.hpp
using Circles = std::vector<sf::CircleShape>;
Circles inputPoints;
Circles vorPoints;
Circles newPoints;
void addPoints (const Points& inputPoints, Visualisation::Circles& outputPoints, const sf::Color& color);
Voronoi.cpp
sf::CircleShape point (s_circleRadius, s_circleRadius/4 + 6);
void VoronoiCut::addPoints (const Points& inputPoints, Visualisation::Circles& outputPoints, const sf::Color& color)
{ // .....
}
I have tried to replace sf::CircleShape and using sf::RectangleShape and get same error.
`_ZThn8_N2sf14RectangleShapeD1Ev' referenced in section `.rdata$_ZTVN2sf14RectangleShapeE[_ZTVN2sf14RectangleShapeE]' of C:\C++\_LIB\SFML-2.6.0\lib\libsfml-graphics-s.a(RectangleShape.cpp.obj): defined in discarded section `.gnu.linkonce.t._ZN2sf14RectangleShapeD1Ev[_ZThn8_N2sf14RectangleShapeD1Ev]' of obj\Release\Voronoi\Voronoi.o (symbol from plugin)
I find what is doing the issue. But I do not understand why.
If somebody has any clue, it would be helpful.
Simple example code with MinGW 13.1 (version used by SFML) on Codeblocks - Windows 11.
#include <SFML/System/Vector2.hpp>
#include "SFML/Graphics.hpp"
#include <vector>
int main ()
{
std::vector<sf::Vector2f> inputPoints;
std::vector<sf::RectangleShape> circles;
return 0;
}
As soon as I add this: std::vector<sf::RectangleShape> circles;
I get the error:
error: ld returned 1 exit status
without any additional information.
So why just declaring vector of RectangleShape can cause such error.
But if I switch off "-flto" for gcc, it compiles without any issue.