C++ Non-Class member compile error in Code::Blocks? - c++

I am attempting to follow the tutorial found here to learn the basic idea behind programming roguelike game. I am using Code::Blocks 10.05 running portable from my usb and compiling with MinGW. Console.h also came from the website I linked above.
I have hit a road block when I have attempted to set up just this class to ensure everything is working:
#include <conio.h>
#include "Console.h"
int main( void )
{
console.Clear();
return 0;
}
When I attempt to use the I get the following error:
Error: request for member 'Clear' in 'console', which is of non-class type 'Win32Console()'|
Any help is appreciated, thanks!
Edit
I reinstalled MinGW and Code::Blocks after promptly ruining them for myself and am now back with the error:
undefined reference to `Win32Console::Win32Console()

before adding the header file, paste this line: #define _WIN32. Its possible that the _WIN32 isn't defined?

Related

CGAL file not found after installation

I recently installed CGAL from their website. I used the native installer that is up to download on the website, and after selecting a directory, the installation completed. I am looking through the User Manual and trying to run some basic code, but I keep getting a compiler error. The code that I run is this (it is straight from the user manual):
// example: construct a quadratic program from data
// the QP below is the first quadratic program example in the user manual
#include <iostream>
#include <cassert>
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// choose exact integral type
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif
int main()
{
}
It is just a simple QP problem, using the syntax straight from the website. However, when I try to run it, I receive this compiler error:
C:\...\include\CGAL\config.h|161|fatal error: CGAL/compiler_config.h: No such file or directory|
I used the installer straight from the website, but CGAL is still giving me these issues. Does anyone know how to solve it? Thank you.
According to the documentation (https://doc.cgal.org/latest/Manual/installation.html#title5), after installing CGAL on Windows, you still need to build the library itself.
This process will (I suspect) create the missing configuration files according to the compiler you have (gcc 7.3).

CImg Compilation Error: t_normal not in global namespace

I'm currently working on a class assignment that requires the use of the CImg library. To be clear, the assignment is not linking the library into the program; The class is using it access the pixel data for later use in the heart of the assignment.
I'm working in Xcode (OS X 10.10). CImg (2.2.2) is installed from homebrew, and I've managed to navigate the weird way Xcode deals with search paths (added the header to the section), and have successfully-ish included CImg.
my full code is as below.
#include <iostream>
#define cimg_display 0 //I don't need X11 at all
#include "CImg.h"
using namespace cimg_library;
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
However, I get 17 Compile-time errors from CImg.h, which are very unusual, and all of the form:
"No member named 't_normal' in the global namespace; did you mean simply 't_normal'?"
Thinking I might have received a bad download, I have attempted to redownload CImg, with no luck. I have also gotten to this same point with non-homebrew versions of CImg.
To verify the download, I also compiled the examples from the command line and they ran perfectly.
Is there a problem with CImg that I'm not aware of, a problem with Xcode that I'm not aware of, or is there something fundamental that I'm missing (definitely an option, my C-style programming is a little rusty) ?
halp pls.
Your code runs fine if you do this:
Create a new Xcode project, with:
type = "Command Line Tool"
language = "C++"
Then go to "Build Settings" and add the path to the directory containing CImg.h to your "User Header Search Paths"

redeclaration of C++ built-in type 'wchar_t' windows 10 glut cpp

I'm trying to run some Glut app in c++, but my codeblocks gives me an error
redeclaration of C++ built-in type 'wchar_t'
and it points into glut.h file line 50 :
typedef unsigned short wchar_t;
I've downloaded this program and moved all src files in new codeblocks project
http://www.mindcontrol.org/~hplus/graphics/fire-particles.html
how to fix it?
I have faced the sane problem. And that is how I have solved the problem.
#include<windows.h>
#include<bits/stdc++.h>
#include <GL/glut.h>
<windows.h> should be added at first or it will show a error. I hope it will solve the problem
Thanks

PCAN USB QT Interfacing issue

I recently purchased one PCAN USB device. I am having trouble interfacing the APIs with my Qt GUI.
I am using #include <libpcan.h> and #include <pcan.h> in my code as mentioned in one sample code. I am compiling the code with -lpcanfd compiler flag . Once I add #include <libpcan.h> in the header and compile my Qt code I get an error like this:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:53:16: error:
expected unqualified-id before 'void' static Qt::HANDLE
currentThreadId() Q_DECL_NOTHROW;
If i comment #include <libpcan.h> the compile process finished without error(s). Can anyone suggest me a solution? Without including libpcan header I won't be able to use the device.

C++ project build, but IDE shows error

Error: cannot open source file "GL/glew.h"
I have the following code :
//Include GLEW
#include <GL/glew.h>
//Include GLFW
#include <GLFW/glfw3.h>
//Include the standard C++ headers
#include <stdio.h>
#include <stdlib.h>
//Define an error callback
static void error_callback(int error, const char* description)
{
...
I took from there: http://www.41post.com/5178/programming/opengl-configuring-glfw-and-glew-in-visual-cplusplus-express#part4
In order to have a somewhat portable solution, before I even started Visual Studio 2013 I created two System Environment Variable in windows.
GLEW=C:\Install\Development\C++\Framework\glew-1.10.0-win32\glew-1.10.0
GLFW=C:\Install\Development\C++\Framework\glfw-3.0.4.bin.WIN32\glfw-3.0.4.bin.WIN32
So in my project I could for instance write a additional include folder as: %GLEW%\include
As I said, it builds fine and runs fine as well.
Yet, not having intellisense behave properly is really annoying.
How to fix it?
My syntax was actually wrong, you cant use global environment variable in VS using %<name>% but you have to use $(%<name>).
Wherever I wrote %GLEW%\include I should have $(GLEW)\include.
It's working fine now.
Though I'm completely clueless why it built.
This post: https://stackoverflow.com/a/11543754/910813 got me to remind that.