Using Common Header Files in eVC++ 3 - c++

I'm learning C++ and i have the eVT(eMbedded Visual Tools) installed in my computer, because of the eVB 3(eMbedded Visual Basic) for my VB pocket programs, but i'm learning C++, then i want to use the eVC++ 3 for develop some command line aplications, then only to test i created an HelloWorld aplication, just for test, but when i try to compile it gave me this error:
Fatal error C1083: Cannot open include file: 'iostream': No such file or directory
Error executing clarm.exe.
Remember that i can't update to eVC++ 4, because i want to build programs for Windows CE 3.1
Thanks!

You need to add the path to the directory where ostream file resides to the list of the compiler include paths (usually -I directive).

Recently i see some eVC++ example and as i can see, eVC++(remember: Plus Plus) only uses C(Without ++) code.

Related

Mosquitto.h not such file or directory

I am working on a c++ project using mosquitto library on github. I am trying to compile the C++ on a windows computer on the command line; however I keep getting error
Fatal error: mosquitto.h: no such file or directory
include "mosquitto.h"
I have installed the mosquitto library in the windows system, underneath:
C:\Program Files\mosquitto\devel\mosquitto.h
Is there something else that I have to do as well in order to compile the cpp from the command line. How do I tell g++ the whereabout of the mosquitto.h file. So I can compile on the command line
Thank for your help I am new to C++.
I managed to solve this question, I had o copy the mosquitto.h into
C:\cygwin64\usr\include
Then when I type g++ nameOfFile it compiled

Compilation error: "stddef.h: No such file or directory"

Whenever I try to compile this code it always ends up with this error:
In file included from /usr/include/wchar.h:6:0,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cwchar:44,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/postypes.h:40,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iosfwd:40,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ios:38,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ostream:38,
from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iostream:39,
from test.cpp:1:
/usr/include/sys/reent.h:14:20: fatal error: stddef.h: No such file or directory
#include <stddef.h>
^
compilation terminated.
The code I was trying to compile is:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World! :D";
return 0;
}
The error is because your gcc-core package and gcc-g++ are not of the same version. Either downgrade one of them to solve the problem or update both the libraries. Updating both the libraries is the recommended way.
I had this error on a fresh MinGW install, it had nothing to do with the installed packages mentioned in the current accepted answer by "Prasanth Karri". In my case the issue was caused by -nostdinc in my Makefile. I actually only needed that compiler flag when building for a different target platform (not when using MinGW) so I fixed the issue by removing that flag from MinGW builds.
When I was incorporating a software library written in C into an existing demo project(used a C++ mbed library) I encountered this problem. The demo project would compile just fine, but after I replaced the existing main file by my own, this error occurred.
At this point I hadn't yet thought about the fact that the mbed library that I needed was written in C++. My own main file was a .c file that #include the mbed header file. As a result I used my normal C source as if it was a C++ source. Therefore the compiler that was used to compile my main file was the C compiler.
This C compiler then encountered a #include of a module that actually does not exist (within its scope), as it's not a C++ compiler.
Only after I inspected the output of the build log I realised the various source C and C++ files were compiled by more that 1 compiler(the c++ compiler). The project used used compilers arm-none-eabi-c++ and arm-none-eabi-gcc (for embedded systems) as seen below.
Compile log:
Building file: ../anyfile.cpp
Invoking: MCU C++ Compiler
arm-none-eabi-c++ <A lot of arguments> "../anyfile.cpp"
Finished building: ../anyfile.cpp
Building file: ../main.c
Invoking: MCU C Compiler
arm-none-eabi-gcc <A lot of arguments> "../main.c"
In file included from <Project directory>\mbed/mbed.h:21:0,
from ../main.c:16:
<Project directory>\mbed/platform.h:25:19: fatal error: cstddef: No such file or directory
compilation terminated.
Of course in a C++ environment cstddef exists, but in a C environment cstddef doesn't exist, in stead it's just C's implementation of stddef.
In other words, cstddef does not exist in the C compiler.
I resolved this problem by renaming my main.c file to main.cpp and the rest of the code compiled smoothly too.
TLDR/Conclusion: When building a C++ project, avoid mixing C files with C++ files(sources and headers). If possible rename .c files to .cpp files to use the C++ compiler in stead of the C compiler where required.
In order to update it, follow below.
If you are on Windows, just run these on command prompt or powershell
Update the package list: mingw-get update
After updating the package list, run: mingw-get upgrade
Source: How to update GCC in MinGW on Windows?
This problem was solved for me as I installed codeblocks with mingw compiler then I copied the mingw folder from codeblocks to C drive and added
C\mingw\bin to the environment variables.
If you try to compile and see a message like, "fatal error: stddef.h: No such file or directory", the error is because your gcc-core and gcc-g++ packages are not of the same version. Rerun the Cygwin install and make sure that you select the highest numbered versions of gcc-core and gcc-g++.
After installing the C++ compiler with MinGW I encountered this problem as well. Apparently, you have to also install mingw32-base. Go to C:/MinGW/bin/mingw-get.exe (my path) and check it for installation at the Basic Setup tab.

C++ Error RC2104 trying to compile PuTTY-PSCP (for Windows) on Visual Studio 6.0

I was about to use PuTTY Development source code for Windows to create my own client application (found here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) but as I tried to compile the PSCP project (SCP Client), I got the following error :
C:\work\2015\Putty\windows\version.rc2 (18): error RC2104 : undefined
keyword or key name: BINARY_VERSION
I've been going through the various posts involving this error but didn't find anything working :
error RC2104: undefined keyword or key name: DS_SETFONT :
On this post I noticed that the version of MSVC was brought up so I figured maybe something has to be done to get PuTTY to work on VC 6.0 ?
Also I tried to add #include <windows.h> in both version.rc2 (version.rc2 is used for inclusion in all .rc files) and pscp.rc, none worked.
I'll be quick to answer if you need any information (project properties, source code...)
USING Visual Studio 6.0 with SP6 on Windows 8.1
Probably, wrong version.h is seen.
Correctly, the file version.h in the project folder should be seen.
Please try to modify version.rc2:
#include "version.h"
to
#include "..\\..\\..\\version.h"
At least, resource compiler will end successfully.
If you search through the PuTTY source files, you'll notice that BINARY_VERSION is defined in version.h and used in windows/version.rc2, which #includes version.h.
Since your version.rc2 isn't seeing version.h, try to figure out why: Is version.h still present and does it still contain BINARY_VERSION? Are your include paths correct? Is there another version.h somewhere else in your include path that's getting picked up by mistake?
Which source code are you using ?
I tested latest(0.64) "Release source code for Windows".
direct link is
http://the.earth.li/~sgtatham/putty/latest/putty-src.zip
I had tried to compile using VC++ 6.0 Professional with SP6, on my PC,
running Windows XP SP3.
After extracting putty-src.zip to somewhere with keeping folder
structures, did you correctly opened 'putty.dsw' in "putty-src\windows\MSVC" folder?
You should be find in 7 projects in 'FileView' tab of the workspace
in Visual Studio 6.0.
You can switch active project to 'pscp' with context menu via
right button click on 'pscp' project.
With modified version.rc2, resource compiler finished successful.
But two (sshshare.c, winsftp.c) C source files failed compiling
with 20 errors. in 'pscp' project.
Errors while compiling 'winsftp.c' is caused 'TIME_POSIX_TO_WIN'
and 'TIME_WIN_TO_POSIX' macros.
'ull(unsigned long long)' is a 64-bit integer-suffix, newly defined in C99. Since C99 standard is not support on VC6, then caused errors.
I had temporally modified
11644473600ull ------> ((ULONGLONG)11644473600)
10000000ull ---------> ((ULONGLONG)10000000)
and confirmed errors are cleared. (Sorry, no validation the code is correctly generated)
3 errors while compiling 'sshshare.c' is also caused another macro.
I cannot understand why you got 116 errors.

Can not find mpirxx.h after building the mpir-2.6.0 library in vc++

I need to use mpir-2.6.0 library with visual c++ 2010. My code is going to be in c++.
I extracted both folders (mpir-2.6.0 and vsyasm-1.2.0-win32). Then, I copied the content of the folder vsyasm-1.2.0-win32 (including vsyasm.exe after renaming it to yasm.exe and placing it in: C:\Program Files\Microsoft Visual Studio 11.0\VC\bin\. Then, I opened the project: mpir.sln which is placed in: \mpir-2.6.0\build.vc10. Then, I changed the Project configuration to: Release.
When I try to build the whole solution, I get a lot of errors such as:
error C1020: unexpected #endif c:\proj\mpir-2.6.0\mpir-2.6.0\mpir.h 4 1 lib_mpir_gc
error C1020: unexpected #endif c:\proj\mpir-2.6.0\mpir-2.6.0\mpir.h 4 1 lib_mpir_gc
error C1020: unexpected #endif c:\proj\mpir-2.6.0\mpir-2.6.0\mpir.h 4 1 lib_mpir_gc
But when I build every library separately, it is successful.
After the build, I went to: \mpir-2.6.0\build.vc10\Win32\Release
and find the files:
mpir.lib
mpirxx.lib
mpir.pdb
mpirxx.pdb
But I can not find the files:
mpir.h
mpirxx.h
Which I need to copy them the visual studio include file.
My main source for these configuration is: http://www.exploringbinary.com/how-to-install-and-run-gmp-on-windows-using-mpir/ (but this was for old versions for the library and the ysam). I do not understand the reasons for these errors. I was able to configure the library with old version. But I need to upgrade as there are improvements in the library and mine is very old one.
The output files are now located in mpir\lib\Win32\Release or mpir\dll\Win32\Release.
The recommended way to build MPIR specifcally for your CPU is to first run mpir_config.py which is located in the build.vc10 directory. mpir_config.py will prompt you with a list of CPU options. Then when you open mpir.sln, you should only compile code for the specific CPU. And then you compile the C++ wrapper (i.e. compile lib_mpir_p3 first, and then lib_mpir_cxx).
Edit: I just noticed another error from your original post. You need to rename the directory "mpir-2.6.0" to "mpir". The directory layout needs to be "<>\mpir\build.vc10"
I had the same problem with MPIR 2.6.0 and VS 2012. What I did to make MPIR work was to build lib_gc and lib_cxx, both with win32 and release mode. Because my c++ application is win32 console, this way it worked perfectly.
Becuase my windows is 64, I thought I had to build 64 versions, but turned out that I was wrong.

Trying to get my game running in VC 2010, can't seem to link SOIL library, don't know how to link, game source code included

I've been using CodeBlocks for a while now as I make a little hobby game in C++. Come across a snag whereby I want to see the current values of all the data in my arrays at any point, CodeBlocks doesn't seem to have that ability. Have been told by workmates (professional game programmers) that I should use Visual Studio.
Have previously used Visual Studio C# in the past, was very handy being able to use a break point while debugging other small games I've made and then going through the big list of watches to look at particular array values or any other value from within my program at that time.
So I've created a new blank project in VC2010 and added all my code files to the project. I know I have to link libraries and such, have spent the last few hours trying to figure out how to do that. But even after all that is done, I'm still getting link errors (I think)
First problem is this:
fatal error C1083: Cannot open include file: 'gl\glext.h': No such file or directory
So I commented it out to see how much further I could get.
Eventually had to add to my main.cpp file
#pragma comment (lib, "opengl32.lib")
#pragma comment (lib, "glu32.lib")
#pragma comment (lib, "libsoil.lib")
I ended up copying the libsoil.a file to C:\Program Files\Microsoft Visual Studio 10.0\VC\lib and renaming it to libsoil.lib (as stated on the authors's website http://www.lonesock.net/soil.html)
So now I get this when I compile
1>libsoil.lib(stb_image_aug.o) : error LNK2019: unresolved external symbol ___chkstk referenced in function _stbi_zlib_decode_noheader_buffer
1>libsoil.lib(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2
1>C:\Repositories\HappyHelperPuppy\CppVer\HappyHelperPuppy\Debug\HappyHelperPuppy.exe : fatal error LNK1120: 2 unresolved externals
..And I have no idea what to do next. I've spent ages in Google and trawling through forums and I really just don't know what to do.
So as a last ditch effort I'm zipping up all my code and project files and letting anyone whos interested to have a look and see if they can find a solution. It's not like this game will have any secret feature I want to keep under wraps, and all the art is from an open game competition from ages ago ("TIGSource Assembly" for those who know what it is) or from DeviantArt (just wanted something to look at while I made it, wouldn't be final game release art)
The code/game can be found here http://users.on.net/~infernoraven/hhp_busted_code.zip (27mb)
The SOIL library should be in the main directory in its own soil.zip
Any help would be good, but I'm just getting really depressed as I seem to spend most of my time either fighting with the IDE/Compilers or some annoying syntax problem.
The CodeBlocks project files should be in there also, so if you..
un-comment out glext.h
link to SOIL
link to libopengl32 and libglu32
Hopefully it'll compile for you. Otherwise there should be an HappyHelperPuppy.exe that's precompiled by CodeBlocks that should hopefully run and give you an idea of what is suppose to happen
In the SOIL package there are a number of project files for visual studio. When I try to load up the VC9 one and convert it to VC10, I get conversion errors.
Conversion Report - SOIL.vcproj:
Converting project file 'C:\Documents and Settings\Administrator\My Documents\Downloads\soil\Simple OpenGL Image Library\projects\VC9\SOIL.vcproj'.
Failed to upgrade platform 'x64'. Please make sure you have it installed under '%vctargetspath%\platforms\x64'
VCWebServiceProxyGeneratorTool is no longer supported. The tool has been removed from your project settings.
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.
Attribute 'Detect64BitPortabilityProblems' of 'VCCLCompilerTool' is not supported in this version and has been removed during conversion.
Failed to upgrade 'Debug|x64'. Please make sure you have the corresponding platform installed under '%vctargetspath%\platforms\x64'
The project configuration dimension name/value "(Platform, Win32)" was not found in the project manifest.
Project upgrade failed.
If I use the VC8 project file and try to upgrade that, a libSOIL.lib file is generated by VC2010 throws an error saying "Unable to start program ... \SOIL.lib The specified file is an unrecognized or unsupported binary format"
But the author on his site states that I can simply rename the libSOIL.a file to a libSOIL.lib file and it should work.
The soil.zip file contains some .sln files under the folder projects. Use the proper .sln file to build the library, then link your project against this library. It worked fine on my side.