Can't include TinyXML in C++/CLI project - c++-cli

I have a C++/CLI project, and I want to include TinyXML.
I downloaded the library, added it as a a new project to my solution and added a reference from my project to the library.
In my code I have
#include "StdAfx.h"
#include "tinyxml.h"
When i compile i get 70 linking errors. I tried to comment #define TIXML_SAFE in tinyxml.h ( saw that on google ) , but doesnt work.
Thanks, Dave

Got it, i included tinyxml in a subfolder of my current project, instead of adding it in its own project. I also used tinyXMLSTL. Thanks.

Related

Visual Studio 2017 doesn't see header files

I'm having an issue with the visibility of header files in my Windows Forms project (Visual Studio 2017). I've included all header files in separate header file called "Header.h". In the first file called "welcome.h", I want to call the next form as shown below...
beta::initial^ f = gcnew beta::initial();
this->Hide();
f->Show();
This is what I'm getting when I'm trying to compile it...
That doesn't actually makes sense to me since initial is the member of beta as shown in this screenshot...
This is how I include my header files in Header.h...
#include <algorithm>
#include "initial.h"
#include "welcome.h"
Every other header file contains...
#include "Header.h"
I also checked if every file is sure to be included in the project and everything is in the same folder. What am I missing?
P.S. This is my first time posting here, so if my question isn't clear, then please guide me.
I just put an answer here:
Style messed up after nuget update.

CLS_LOG macro does not work in one class

I'm using the Crashlytics CLS_LOG macro throughout my project. It's working everywhere except in one class, where I get Implicit declaration of function 'CLS_LOG' is invalid in C99. If I comment out the calls in that one class then the entire project compiles fine.
I'm including Crashlytics in my prefix.pch like this:
#ifdef __OBJC__
// Other imports
#import "Crashlytics/Crashlytics.h"
// Other imports
#endif
I've trying clearing pre-compiled headers, reinstalling the Crashlytics framework, and more - nothing has helped.
Any idea what could be breaking the macro in a single class?
I figured it out.
The problem was that I had added this class to the compiled sources for a new target (a widget), but I hadn't added the Crashlytics framework to that target.
I also followed the instructions from this answer to create a prefix.pch for the widget target, added Crashlytics to that, and now everything is compiling as expected.

Drawing Text in OpenGL on Mac OSX using GL3_Text sample method

So I found Apples great sample called GL3 Text.(LINK) Seems to be doing exactly what I need using included libraries.
I imported the toolkit folder from the sample as it contains everything I need to make it work.
In order to declare a variable type I need, as well as use some methods they had setup in the sample, I need to import OpenGLText.h in my openglview class.
Problem is, when I do this another file from the sample, OpenGLContainers.h, gets errors on these 3 lines
#import <map>
#import <string>
#import <vector>
The error says, for example, "'map' file not found."
If I take out the OpenGLText.h import line, everything compiles fine and I'm able to right click -> jump to definition, on those 3 lines that previously had errors.
I've already double checked that I'm includeing the frameworks they use in the sample. Cocoa, OpenGL, and GLKit.
Any ideas on how to fix this? Seems like theres something conflicting with the imports.
If you don't know how to fix, but have suggestions on other simple ways to render text on an opengl surface on Mac let me know!
Have you tried the advice in the stack overflow posts below?
.h file not found
XCode - #include <map> in ml.hpp : No such file or directory
Lexical or Preprocessor Issue with "#import <map>
Best Regards,
Magnus
Those are C++ headers. You have to compile the sources using those headers as C++ or Objective-C++.

Glew not compiling in Xcode

I tried using the Glew Library for shading and was trying to compile a simple program using the NSOpenGLView Class in Xcode 5. The program fails at the following code in glew.h
#if defined(__gltypes_h_)
#error gltypes.h included before glew.h
#endif
It says that Gltypes.h is included before glew.h.
My implementation file for OpenGLView has headers included in following fashion:
#include <glew.h>
#import "OpenGLView.h" // Includes Cocoa.h
#include "LoadShaders.h" // Includes <OpenGL/gl.h>
So, if glew.h is included in the beginning, why is the error coming here. None of the other headers are included before the inclusion of glew.h, so tests for them(like gl.h) are passing in glew.h. I am not able to find out here as to who is including Gltypes.h in this file.
Hope anyone has a clue to it here.
The precompiled header file (.pch) pulls Cocoa in. Edit it to include glew.h before Cocoa.h and you are good to go.

Why do I get the error "error: unknown type name 'virtual'" when trying to compile this code?

Code:
struct IRenderingEngine {
virtual void Initialize(int width, int height) = 0;
virtual void Render() const = 0;
virtual void UpdateAnimation(float timeStep) = 0;
virtual void OnRotate(DeviceOrientation newOrientation) = 0;
virtual ~IRenderingEngine() {}
};
Learning opengles from a book for 3d iphone programming and it uses this example code but the book is targeted for xcode 3.x
Somehow I feel like its something with xcode 4....
EDIT:
Heres the actual error:
/Users/Dan/Documents/opengles/Hello Arrow/Hello Arrow/IRenderingEngine.hpp:27:2: error: unknown type name 'virtual' [1]
And that legitamtely is all that it takes to fail to compile, absolutely no other files. (Yes I've tried compiling with literally a main.m and this hpp file)
It is recognizing the hpp file as a cpp header file though, if I try to add it to the compiled files it says that "no rule to process file '$(PROJECT_DIR)/Hello Arrow/IRenderingEngine.hpp' of type sourcecode.cpp.h for architecture i386" so I really have no idea what is going on
Note that I compiled with main.m meaning I compiled another Cocoa/Foundation based application
I tried compiling for a c++ application and everything worked out just fine....
Similarly compiling with a main.mm test file worked fine too
heres the actual project, lemme know how insane I really am:
[Removed considering I lost the file]
Please rename the main.m to main.mm. This worked for me.
If you're using Xcode 4, try changing the name of file "AppDelegate.m" to "AppDelegate.mm". It works for me.
Changing the name of file "AppDelegate.m" to "AppDelegate.mm". It's correct!
I moved the #import "IRenderingEngine.hpp" line from the GLView.h file to the GLView.mm - this prevented it from being imported into the main.m and HelloArrowAppDelegate.m files when they were compiled - and restricted the import into the .mm file, that could handle the C++.
I also had to make a couple of other fixes for bugs I'd introduced when typing in the code - so apologies if that wasn't the only thing that needed to be done, but it might help those with similar problems!
if you call C++ files ( even if you only import them ) you need to change the .m file that call's it to .mm
This is just a stupid guess since I've never tried compiling something with the word virtual in a C compiler... but is there any chance that you were trying to compile this C++ code as C code? That's the only reason I can think of that a compiler wouldn't understand the keyword virtual.
The header <stdlib.h> is not the right one to use in a C++ program. When I replaced it with the c++ version of C's stdio library <cstdlib> then your code compiled for me.