Debugging SFML Project in Xcode - Install to Blame? - c++

I followed the instructions to set up SFML here. When I check my /Library/Frameworks folder, all the SFML stuff seems to be there. However, when I check out a project my group is working on using SFML, and when I build, I get a ton of errors. These errors do not exist for my other group members. I think (some of) my errors are caused by SFML not recognizing sf::Input as a type.
Here is my code for one of the header classes in my project:
#pragma once
#include "Mover.h"
class InputMover : public Mover
{
public:
InputMover(const sf::Input* pInput);
//error here - expected unqualified-id before * token
protected:
const sf::Input* m_pInput;
//error here - ISO C++ forbids declaration of Input with no type
};
The parts without errors have been taken out. What do you think the problem is?
EDIT, SOLVED:
The problem was that I installed SFML with makefiles before I just did a copy-install. Some files were conflicting. I tracked down the installed files and deleted them. This seemed to fix the problem.

To use the SFML classes you need to include their definitions.
Add #include <SFML/Window/Input.hpp> to the top of your file.
Also note that to use SFML you must also link to the CoreFoundation, Cocoa and OpenGL frameworks, as well as to libfreetype.

Related

Why am I getting this error with MinGW and Cmake?

So I am trying to compile this flip fluids addon with blender, so I followed this tutorial, https://www.youtube.com/watch?v=TVKM1egDoGs , So I first ran cmake.exe -G "MinGW Makefiles" .. and it was telling me that it was missing a CMakeLists File... So I added one... then I ran cmake.exe --build . and it got to 3 percent than showed me errors like ...
In file included from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/threadutils.h:29,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/meshlevelset.h:65,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/meshobject.h:30,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/fluidsimulation.h:38,
from C:\Users\N\Downloads\Blender-FLIP-Fluids-master\src\engine\c_bindings\fluidsimulation_c.cpp:25:
C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/mutex:93:9: note: previous definition of 'class std::recursive_mutex'
class recursive_mutex : private __recursive_mutex_base
^~~~~~~~~~~~~~~
In file included from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/mingw32_threads/mingw.condition_variable.h:25,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/threadutils.h:31,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/meshlevelset.h:65,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/meshobject.h:30,
from C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/fluidsimulation.h:38,
from C:\Users\N\Downloads\Blender-FLIP-Fluids-master\src\engine\c_bindings\fluidsimulation_c.cpp:25:
C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/mingw32_threads/mingw.mutex.h:142:44: error: conflicting declaration 'typedef class std::_NonRecursive<std::recursive_mutex> std::mutex'
This is the full error https://pastebin.com/KTnALG1E, where is this coming from?? is it a mingw error or what? Can someone help please?
Your full error message includes a more interesting bit:
C:/Users/N/Downloads/Blender-FLIP-Fluids-master/src/engine/mingw32_threads/mingw.thread.h:32:2:
error: #error This version of MinGW seems to include a win32 port of
pthreads, and probably already has C++11 std threading classes
implemented, based on pthreads. It is likely that you will get class
redefinition errors below, and unfortunately this implementation can
not be used standalone and independent of the system header,
since it relies on it for std::unique_lock and other utility classes.
If you would still like to use this implementation (as it is more
lightweight), you have to edit the c++-config.h system header of your
MinGW to not define _GLIBCXX_HAS_GTHREADS. This will prevent system
headers from defining actual threading classes while still defining
the necessary utility classes.
So either install a different version of mingw or edit your mingw files according to the instructions above.

Annoying Qt issue resulted from an experiment with the inclusion of <stdio.h>

As I was playing around with Qt I decided to use stdio.h in order to test some things. But as soon as I had built the application it started giving me errors such as :
\dir\ :16: error: C2248: 'QString::QString' : cannot access private
member declared in class 'QString'
Naturally, to rectify this issue I just removed the #include and I thought it would work. It did not.
Even after a clean and a qmake the error persists and now my perfectly working code is rendered useless from a silly inclusion of stdio.h.
enormous sigh fueled by relief and self-disappointment
Just manually create a new kit and the issue would fix itself. If you have more than one kits, I think changing between them would fix it too.

OpenCV 3.1.0: /usr/local/include/opencv2/legacy/legacy.hpp can't compile

I'm getting loads of errors like
/usr/local/include/opencv2/legacy/legacy.hpp:2994:12: error: 'CvSubdiv2DEdge' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:3002:12: error: 'CvSubdiv2DPoint' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:1757:36: error: 'cv::EM' has not been declared
With OpenCV 2.4.13 it compiles just fine. It looks like they actually forgot to add some necessary includes into legacy.hpp. What's going on?
Sorry for being misleading, but there's actually NO such header in the standard setup. My setup was mixed up with another, older version of opencv, and it wasn't packed into a deb file, just a bunch of files within /usr/local/. Funny thing is, it was a clean install.
After reinstalling the OpenCV from scratch and removing those old files, errors changed to legacy.hpp being missing - which is exactly what is required here.
Here is the proof: http://answers.opencv.org/question/42622/opencv-30-deprecated-opencv_legacy-module/. Also, from OpenCV Transition Guide: "legacy, nonfree modules have been removed. Some algorithms have been moved to different locations and some have been completely rewritten or removed."

Assimp won't build correctly in Code::Blocks - "TVITEMEXW not declared in current scope"

I'm currently working through the LearnOpenGL tutorials, which has been going fine thus far, until I've hit the model loading portion of the tutorial.
LearnOpenGL uses the Assimp library to handle model loading, but I don't seem to be able to get it to build properly (precompiled libraries don't work either for me) - it produces errors within "Display.cpp":
In function 'unzOpenCurrentFile3':
Line 1177: warning: assignment from incompatible pointer type
In member function 'int AssimpView::CDisplay::AddNodeToDisplayList(....'
Line 179 error: 'TVITEMEXW' was not declared in this scope
With the line 179 error appearing to be the main cause of failure. Having looked in the 'Display.cpp' file, the issue is with the following declaration:
TVITEMEXW tvi;
And TVITEMEXW doesn't seem to be declared/included within the file explicitly, but the included headers are stdio.h, stdlib.h, string.h, and "./unzip.h". After some searching, I've found that TVITEMEX is a windows structure with TVITEMEXW as a unicode name (according to this) but I'm fairly new to C++/compilers etc., and don't really know what to do with this information.
I created the Code::Blocks project file with CMake and MinGW from the Assimp 3.2.
Any help would be hugely appreciated, I've been stuck with this for a few days now and can't figure out how to resolve it myself. Apologies if I haven't provided enough/the correct information, I'm not entirely sure exactly what is relevant to the problem.
try replacing TVITEMEXW with TVITEMW and maybe sNew.itemex with sNew.item.

'class Poco::XML::Element' has no member named 'getNodeByPath'

I am trying to set up openFrameworks with QT, but it seems that i had no success so far. I included all the necessary files i.e. includes, libs etc, but as soon as i compile the program it's showing an error
/home/kalyan/of_v0.9.3_linux64_release/libs/openFrameworks/utils/ofXml.h:204: error: 'class Poco::XML::Element' has no member named 'getNodeByPath'
Poco::XML::Element *e = (Poco::XML::Element*) element->getNodeByPath(path);
^
I even asked in openFrameworks forum, but haven't got any reply.
I am running an example "3dPrimitivesExample" that has been included in openFrameworks build. I built that particular example using make, it generated object files and finally generated an .exe file.
Are you having the same problem I had last week? Old version?
See here:
'Keywords' is not a namespace-name
There is an excellent writeup on how to link QT to Poco using CMAKE in this link here (I never figured out how to do it using QMake):
Clion, cMake and POCO