Using Windows header files within Netbeans 6.8 - c++

I'm trying to make an windows application within Netbeans.
When using Visual studio it is no problem to use files like tchar.h
I have receaved a basic file structure containing those and I'm trying to get them to work on Netbeans IDE but it seems that Netbeans won't allow using files from Visual Studio.
I have tried to add the tchar.h file and all other file it required (including some C++ core files) and commenting the errors written in those care files:
#error ERROR: Use of C runtime library internal header file.
But netbenas can't find the tchar.h file while being in same folder...

If you're using gcc you might consider using the unix style wide characters instead of the microsoft specific version. Look at wchar.h
http://en.wikipedia.org/wiki/Wchar.h

Related

Does VS2015 automatically include windows SDK header files but not in VS2017?

I have a C++ library originally developed in VS2015 which uses SOCKET from Winsock2 inside Windows SDK 8.1. The solution file is generated from a cmake file, and it builds perfectly fine.
I use the same cmake file to create the solution again in VS2017. However, I can not compile it unless I add #include <WinSock2.h> at the file where SOCKET is being used. It looks like it's not picking up the definition of SOCKET unless I explicitly include the WinSock2.h file. And I don't need to do that in VS2015.
I checked the project properties and they look the same and are both using Windows SDK 8.1. So what is the difference here with VS2015 and VS2017? Does VS2015 automatically include windows SDK header files but not in VS2017?

CritSec.h not existent (Win 8.1)

I have this sample code I'm currently using to write a dll in c++.
In this file critsec.h is included.
However on my system (Windows 8.1 Pro 64bit) Visual Studio 2013 CE can't find the source file.
Am I missing some sort of SDK or something?
In the project file belonging you your example file, you see the following additional include directories (reformatted for better reading):
<AdditionalIncludeDirectories>
%(AdditionalIncludeDirectories);
$(MSBuildThisFileDirectory);
..\..\Common
</AdditionalIncludeDirectories>
And indeed, in ..\..\Common, you will find CritSec.h
How do you include this? There are two ways. If you you use #include "something.h" the file has to be at the same location where youre .cpp is. If you use #include than the header has to be at a directory in visaul studio.

C++ Including Visual Studio header files in Qt project. <xstring> include error

I have found a library to generate barcodes (libbarpp). I would like to use this library in my Qt project.
Doing a svn checkout of the source: http://libbarpp.googlecode.com/svn/trunk/ reveals a nice VS example in the src folder. I opened the project in VS and found the included header files. I have included these header files in my Qt project, however i encountered a problem when several of the files required a system header file
#include <xstring>
In VS i can see the this file is located in (on my system):
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring
However the files does not have any extension and i don't really know what to do with it.
Do i need to include something in my Qt project file in order to use this VS file?
I tried including
CONFIG += stl
to my Qt project file, but with no luck.
Any help or comments is greatly appreciated.
EDIT: I'm using Qt 5.2.1 with MinGW compiler
xstring is a Microsoft specific header that contains implementation of std::basic_string and some related specializations.
It shouldn't be included directly in the first place and unless the code you are talking about is using something implementation specific from that file you should be fine replacing it with just:
#include <string>

Can I compile a Visual C++ project on Linux using xbuild?

I have an existing project that I compile on both Windows using Visual C++ 2008, and Debian Linux. This project uses a standard Visual C++ .vcproj file, and some .cpp and .h files. It does not rely on any Windows specific stuff. Just plain C++.
It compiles and run well on Linux, using a home made tool that reads the .vcproj file to generate a Makefile which is used with make to compile and link all files using g++.
The trouble is that with Visual C++ 2010 (and 2012), the format of the project files have changed. Even the name has been changed from .vcproj to .vcxproj. My home made tool cannot read this new project file to generate the Makefile.
Instead of upgrading the home made tool to support new project files, I was wondering if xbuild would be able to compile my Linux executable?
I tried first to compile my own (VC++2008) project, but xbuild complains that my project is a VS2003 project, which is not supported by xbuild. However when googling on this matter, I find that xbuild is supposed to support VS2005 project files. There are also some references to mdtool to support these old project files, but I seems to be integrated into xbuild now.
Furthermore, I tried to compile a Visual C++ 2010 example (HuoChess) got from the MSDN site. The result is
/Microsoft.Cpp.Default.props: Project file could not be imported, it was being
imported by [...] /HuoChessConsole/HuoChessConsole.vcxproj: Imported project:
"//Microsoft.Cpp.Default.props" does not exist.`
Now, this looks like the project file wants some Microsoft definitions of rules for the Cpp compiler. Should I fake these definitions to use gcc instead? How can I do this?
Is what I want to do ever possible with xbuild?
There is a project GCCBuild which you can use to build vcxproj projects in Linux. It simply uses same vcxproj but uses GCC to compile and build. There are multiple examples there too.
PS. I am the author of that project.

Creating a C++ visual studio project based on existing files

I've never worked with C++ or C. I'm trying to create a Visual studio project based on existing files which can be found here: example1.cpp together with the resources. As you can see this is example code of a book for OpenGl. I have opengl and glut present on my computer and they work ( tested it).
Based on the files mentioned above a created an empty C++ project in visual studio 2012 (i also have other versions installed if you can provide a solution in 2010 or so). I included the header files & the source file. Though I still get the following in my IDE:
with errors such as:
cannot open source file "Angle.h"
( Though the file is present in the project)
Can anyone tell me how I get these files to compile and run ?
Make sure that the file angel.h it's in the same path that the .cpp file.
Header files need to be in same directory with source files in order to use #include with quotes.
#include "header.h"
In other words Angel.h must be in same directory with example1.cpp.
However,you can add spesicific paths to your project from Project Settings>VC++ Directories and include header files which exists in those paths using
#include <header.h>