Header file iomanip - header-files

3 20 C:\Users\DELL\Desktop\Dev C++\template.cpp [Error] iomanip.h: No such file or directory
am using the compiler of Dev c++ and while am using manipulator such as setw(),setprecision() and so on I need to use the .
but it gives me the above error

I think what you want is just <iomanip> not <iomanip.h> also if you are not using namespace std; you should call the function like this std::setprecision(5)

Related

Printing inside a class (C++)

I'm having a trouble in my Visual Studio C++ Project.
At the moment in my main.cpp I can print using:
#include <iostream>
using namespace std;
I have tried to print inside a different file Party.cpp
using the same methods in the main.cpp, but I have noticed that including <iostream> gives me errors like :
Error 4 error C2059: syntax error : ')'
in tmmintrin.h line 90.
I have no idea what is tmmintrin.h , it is not on my project and my project can not be compiled because of that reason.
If anyone have faced this problem / know how to solve I would like to get helped.
The problem is solved it was
#include "Party.h"
using namespace std;
#include <iostream>
and i changed the order to
include <iostream>
using namespace std;
#include "Party.h"

'printf': identifier not found

I have included stdio.h into my C++ project, why am I still getting this error? Also, after I added #include , printf(), in my code, was no longer underlined in red to suggest that there was any error.
Also, I would like to use the function, format(). Which library is that found in?
you must include stdio.h instead of cstdio.h
#include <stdio.h>
Use #include< cstdio>
using namespace std;
after that you can use printf()

IAR Workbench can't find std::string

I'm trying to compile CppUTest as a library on IAR Workbench v6.3.3 for the AVR UC3C0512C on Windows 7 x64 but when I compile it, it says that the std namespace is not defined.
Here is the snippet of code where I get the first error, the file is SimpleString.h:
#if CPPUTEST_USE_STD_CPP_LIB
#include <string>
#include <stdint.h>
SimpleString StringFrom(const std::string& other);
The last line contains the std::string and this brings me 190 errors all related to this. The message is:
Error[Pe276]: name followed by "::" must be a class or namespace name
C:\COM\SRC\cpputest35\include\CppUTest\SimpleString.h 143
I have tried using the line below but it does not help:
using namespace std;
Under Library Configuration I select Normal DLIB, I also tried with Full DLIB but IAR can't see the std library
Any ideas please?
According to the IAR manuals
The std namespace is not used in either standard EC++ or in Extended EC++. If you
have code that refers to symbols in the std namespace, simply define std as nothing;
for example:
#define std // Nothing here

Conflict between OpenCV and Boost filesystem

I'm having a problem with Boost libraries, particularly filesystem when used with OpenCV. Apparently the problem is similar to the one described in Conflict between Boost, OpenCV and Eigen libraries?. In that particular case the problem was solved by preceding the "using namespace" statement with all the "#include" statements. In my case, this was done in this way from the beginning.
I'm using OpenCV 2.4.3 and Boost 1.48 (already tried with 1.52 having the same exact problem). The programming is being done in Windows 7 (64 bit) using Eclipse CPP plugin and MinGW.
When trying to build my program I get the following errors:
C:\Boost\boost_1_48_0/boost/type_traits/decay.hpp:28:66: error: 'cvflann::<anonymous enum>' is/uses anonymous type
C:\Boost\boost_1_48_0/boost/type_traits/decay.hpp:28:66: error: trying to instantiate 'template<class T> struct boost::remove_reference'
C:\Boost\boost_1_48_0/boost/type_traits/decay.hpp:38:17: error: 'cvflann::<anonymous enum>' is/uses anonymous type
C:\Boost\boost_1_48_0/boost/type_traits/decay.hpp:38:17: error: trying to instantiate 'template<class T> struct boost::remove_reference'
In my case the using namespace statements are after the include statements:
#include <opencv2/opencv.hpp>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <vector>
#include <boost/filesystem.hpp>
#include <boost/multi_index_container.hpp>
using namespace std;
using namespace cv;
using namespace boost::filesystem;
Any idea in how to solve this problem will be greatly appreciated :D:D:D
Regards,
Luis
I suggest you remove the section:
using namespace std;
using namespace cv;
using namespace boost::filesystem;
and use the scope operator :: in code.
Here's an example of these 2 different modes.

Getting fatal error for iostream

I wanted to write a simple clang plug-in. So I just executed a "PrintFunctionNames" plug-in provided in llvm-clang. But when i tried to execute a command :
" clang -cc1 -load ../../Debug+Asserts/lib/libPrintFunctionNames.so
-plugin print-fns some-input-file.c "
it gives me 1 fatal error :
fatal error: 'iostream.h' file not found
#include<iostream.h>
^
1 error generated.
I also tried using -I option providing a path for include directory of 'iostream' but it's still gives me the same error.
I tried it like:
'clang++ -I//usr/include/c++/4.6 -cc1 -load
../../../../Release+Asserts/lib/libPrintFunctionNames.so -plugin
print-fns ak.cpp '
So how do I make this work?
Don't add .h at the end.
#include <iostream>
That should fix it.
iostream belongs to C++ not C. So you should include it as
#include <iostream>
Additionally since you are programming in C++ you should name your source file ending with .cpp not .c to make it clear to the compiler and everyone else, that you want to use C++. Also you might need to invoke clang++ in your first compiler call (but I am not sure about that in context of plugins)
After the C++ language was standardized by the ISO, the header file named iostream.h was renamed to iostream. Change your program to use #include <iostream> instead and it should compile.
You will also need to add using namespace std; statement after each include (or prefix each reference to an iostream function/object with std::).
You can start by using this
#include <iostream>
using namespace std;
Once you are more comfortable with namespaces, you can remove the using statement & instead either use std::cout, std::cin etc or have a
using std::cout;
using std::cin;
etc.
I meet the same question,
template.cpp
g++ template.cpp
compare<int>com1(3,7);
List item
compare<double>com2(12.34,56.78);
compare<char>com3('a','x');
cout<<",the max value:"<<com1.max()<<endl;
cout<<",the max value:"<<com2.max()<<endl;
cout<<",the max value:"<<com3.max()<<endl;
return 0;
the question is up code segment composing not OK, use the shift + table typing next time.