header-files

Unable to include SFML header files in CLion project

蓝咒 提交于 2019-12-26 01:31:53
问题 I'm quite new to CMake and C++ in general, so today I've tried to import an external library like SFML to my project in Jetbrain's IDE CLion, but without any luck. After spending a whole day learning about CMake in general and making SFML work with CMake in particular, I've finally managed my project's CMake to find the SFML library files. However, when I approached a header file of my own to include a SFML header, I encountered a problem as it didn't find any headers from the library - And

Can't use 'defined(@array)' warning in converting .obj to .h

心已入冬 提交于 2019-12-25 18:41:40
问题 I'm trying to convert my .obj file to a .h header file, but i'm getting "Can't use 'defined(@array)' (Maybe you should just omit the defined()?)" warning and no .h files has created. I've tried replacing @center to $center or omintting defined() but it creates .exe file! I've read somewhere that it may be a perl version problem, mine is 5.22 and I couldn't find higher versions to try. Update1: I've put the "obj2opengl.pl " and "myobject.obj" in the same folder. and trying to convert it with

System Header and normal header gcc

天大地大妈咪最大 提交于 2019-12-25 09:27:17
问题 I know it is a very stupid question but I cannot get the difference between system header and normal header in gcc. Refering to this link: 2.8 System Headers The header files declaring interfaces to the operating system and runtime libraries often cannot be written in strictly conforming C. Therefore, GCC gives code found in system headers special treatment . All warnings, other than those generated by ‘#warning’ (see Diagnostics), are suppressed while GCC is processing a system header.

Struct from one header file in another header file

北城以北 提交于 2019-12-25 08:26:44
问题 I'm going trought this really quite long time and still don't see where could be the poblem. Let's have header file Player.h #ifndef PLAYER_H_ #define PLAYER_H_ typedef struct player { char *name; int gameId; int socketfd; int points; int state; }player_struct; #endif /* PLAYER_H_ */ And let's have second header file Game.h #ifndef GAME_H_ #define GAME_H_ #include "Player.h" #define NUMBEROFPLAYERS 2 typedef struct game { //Here }game_struct; #endif /* GAME_H_ */ The purpose of my typedef is

unknown type name 'class'

狂风中的少年 提交于 2019-12-25 07:49:11
问题 I'm creating a small library for several geometric shapes. Doing so, I'm writing down prototypes into a shapes.h file and the methods into a shapes.cpp file. This is the header: #ifndef __shapeslib #define __shapeslib class Shape{ protected: struct dimensions{ double heigth; double width; }; double radius; // for circle class to be inherited public: Shape(double heigth, double width); // Constructor Shape(const Shape & shape); // copy constructor for class ~Shape(); // Destructor virtual

Using two headers with the same function names

此生再无相见时 提交于 2019-12-25 07:26:19
问题 I want to use some of the functionality of <termios.h and <asm/termios.h> , but they contain functions with the same name, and only including them both I got error: redefinition of 'struct termio' . I managed to use some of <asm/termios.h structures ( struct termios2 ) by isolating the #include directive exactly where I need (in a function). void MyClass::MyMethod() { #include <asm/termios.h> struct termios2 tio; // do stuff with tio variable. } This works fine for only one function, but if I

Call functions in other files in C++ and OpenCV

倾然丶 夕夏残阳落幕 提交于 2019-12-25 07:07:45
问题 I know this might be a possible duplicate but I have actually gone through several posts on SO to try and solve this problem I have the following code in OpenCV and C++ test.cpp #include "opencv2/core/core_c.h" #include "opencv2/core/core.hpp" #include "opencv2/flann/miniflann.hpp" #include "opencv2/imgproc/imgproc_c.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/video/video.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/objdetect/objdetect.hpp" #include

Swift - bridging header compiler error

醉酒当歌 提交于 2019-12-25 01:45:58
问题 I added to my project bridging-header file so I can use opencv in swift. I decided that I don't need opencv so I deleted the bridging header file , after I did it I couldn't run my project because of this error: :0: error: error opening input file '/Users/user1/Desktop/project_name/project_name/project_name-Bridging-Header.h' (No such file or directory) this error appeared in the Compile Swift source files > Precompile bridging header section. I tried cleaning my derived data and I tried

Undefined type error even with forward declaration

不问归期 提交于 2019-12-25 00:48:26
问题 I was reading up on circular references and forward declarations. I do understand that it is not a good design practice to have implementations in a header file. However I was experimenting and could not understand this behavior. With the following code (containing the forward declarations) I expected it to build, however I get this error: Error 1 error C2027: use of undefined type 'sample_ns::sample_class2' Header.hpp #ifndef HEADER_HPP #define HEADER_HPP #include "Header2.hpp" namespace

How to implement class objects in header file C++

自作多情 提交于 2019-12-24 22:17:18
问题 How to implement class objects in a header file so every time I include the header file, I can access the object in the cpp file? Here is my code now: //motor-config.cpp #include "core.hpp" #define create_motor_group(x,y...) Motor_Group x ({y}) create_motor_group(fullDrive, frontLeft,rearLeft,frontRight,rearRight); create_motor_group(leftDrive,frontLeft,rearLeft); create_motor_group(rightDrive,frontRight,rearRight); create_motor_group(lift,leftLift,rightLift); create_motor_group(roller