I am trying to use cplex in eclipse in Ubuntu 12.04 but when I include ilocplex.h I get the following error
/opt/ibm/ILOG/CPLEX_Studio124/concert/include/ilconcert/ilosys.h:360:22: fatal error: iostream.h: No such file or directory
The only two includes are written as follows:
#include <ilcplex/ilocplex.h>
#include <iostream>
I would appreciate if anyone could help me with this.
At the time ILOG's Concert library was first released, the older iostream.h headers were still common in C++ compilers, but it supports the standard iostream libraries. To use the standard headers and libraries, you need to define the IL_STD preprocessor symbol. Instructions for defining preprocessor directives in Eclipse/C++ can be found in this question.
Try reading the manual again or look again at the samples. Cplex has supported both the old style iostream.h and the newer C++ iostream standard for at least a decade. I just don't have the manual with me right now to give the full reference.
Related
I have large C++ project that I inherited and am trying to transfer it from Linux to Visual Studio on Windows. Managed to link required libraries, but one build error just baffles me.
In Linux, someone was including a header <error.h> everywhere, and I can't even find a documentation page to see what it is. First I thought is part of standard library, but I am now beginning to see it's a specific header for Linux OS.
So, how do I include it in Visual studio? I can't even find what it is and am tempted to just rearrange code to use stdexcept header, as the only thing these codes do is abort compilation and printout error messages by using some error(...) function from error.h.
error.h is a header from the GNU C Library. It is not specific to Linux, it is specific to glibc.
It is documented right here (search on the page for error.h).
The functions declared in error.h should not be used in portable code, so getting rid of code that uses them is not a bad idea. Alternatively, it is not difficult to implement them.
Dev-C++ cannot find the I/O stream header files. I tried it with both #include <iostream> and #include <iostream.h> but I get the following errors.
[Error] iostream.h: No such file or directory
[Error] iostream: No such file or directory
What can I check in the Dev-C++ settings to make sure it's properly configured to build programs that use the C++ Standard Library?
#include <iostream>
You've got a double 's' in your code as far as I can see and that may be causing a problem. If including "iostream" header file won't work as well it means that your Dev-C++ (sic!) is probably not linked with MinGW properly.
As the others said, consider using f.e. Code::Blocks instead Dev-C++.
If you didn't download the Dev C++ that includes MinGW then you don't have the standard libraries. If you do have the standard libraries you will need to make sure to set it up by pointing it to the location of the source on your system.
If you still need the standard libraries, you can go to "Downloads" section of this page and go to the first link which includes MinGW.
But your best bet is to send Dev C++ off to die in a fire. The incredibly powerful Visual Studio 2015 is out and the Community version is free: https://www.visualstudio.com/downloads/download-visual-studio-vs There's really no excuse for using anything else on Windows.
I want to use an std::vector for an app that I'm creating with Tizen and I can't find the right library to include to make my std::vector be recognized...
I have a syntax error...
Is there an equivalent to std::vector specific to Tizen? I searched the web but I didn't find anything...
I tried #include <vector> Tizen doesn't recognize it, that's what my problem is because in "normal" C++ it works fine. Only I'm using Tizen with Tizen IDE (Eclipse plug-in) and it doesn't recognize the library so I'm wondering which library I need to include instead (I got a fatal error: file not found when I use the include I mentioned).
I can't post images so here's a transcript of the error message:
type name requires a specifier or qualifier
syntax error
expected expression"
All of which regarding this line:
std::vector<int> vect;
OK, I found my answer. It seems Tizen is using C and not C++... I didn't see it because some libraries I sometimes use when I code in C++ were included like they should. Anyway I'm just gonna have to find the C equivalent of vector now and my problem will be solved.
https://developer.tizen.org/dev-guide/2.2.0/
The Tizen C++ application supports C++ based on the Standard C++ ANSI ISO 14882 2003, which includes the Standard Template Library (STL). This helps developers migrate the pre-existing standard library based applications to the Tizen platform with minimum effort.
More specifically, Tizen supports complete set of libstdc++v3 comprising of standard C++ functions specified in the Standard C++ ANSI ISO 14882 2003 and the entire Standard Template Library (http://www.sgi.com/tech/stl/).
These methods can be used by including the relevant header file in a standard manner, for example, "#include <stdio>".
Support for standard C++ library extended to complete set of libstdc++v3 modules, namespaces and classes.
For more information, refer to this Web site.
Remarks:
The locale based feature is not supported in Tizen.
So #include <vector> should work fine.
Since you say that you can't include any C++ headers, I suspect the problem is that the compiler is compiling your code as C instead of C++. Affirm that your file has the .cpp extension, and view the file's properties in the project to confirm that the IDE is treating the file as C++. (I don't know where that setting is, I don't have Eclipse). This link says to delete your project and create a C++ project instead of a C project, then re-import your files. This link says you can set the "File Type", but also implies it doesn't quite work.
You say: I searched the web but I didn't find anything...
Google "std::vector" The first hit is
http://en.cppreference.com/w/cpp/container/vector
which says:
Defined in header <vector>
So the answer is: Learn to use Google.
I think the wrong answer was accepted...the clue is in the tags used by the OP.
The compiler used by Tizen studio determines whether a source file or header file is C or C++ based on the file extension. So if your header file is .h and you include < vector > then the compiler will complain since there is no C equivalent library for vector.
If you rename you header to .hpp, or your source to .cpp, and recompile then it will compile without error.
I'm attempting to use some types from TR1/functional. I have the following reference in my header file:
#include <tr1/functional>
This is resulting in an error:
C1083: Cannot open include file: 'tr1/functional': No such file or
directory.
This has always worked before. I've been browsing MSDN trying to determine if I'm missing a library reference or something of the sort, but for the life of me I'm unable to find out what is wrong with my project configuration.
I'm using C++11 and working in Visual Studio 2013 Developer Preview.
The <tr1/*> headers should have been deprecated or removed following their inclusion in the standard. So they're mostly there for older compilers such as VS2010 or VS2008. Including <functional> alone should fix it.
A couple things to note though, although I do not know if it applies to VS2013 is that std::regex's include is <regex> yet still resides in the old std::tr1 namespace.
I am also using VS 2013 and faced same problem. After few research, finaly I got it working using Boost. It is prety well supported.
I have a Microsoft Visual C++ 6.0 Project and converted it successfully with MS VS Professional 2010 Trial. No conversion problems occured. However, when building the converted project it tells me, that "iostream.h" cannot be found.
I am aware of the new and standardized "iostream" and the "using namespace std" fix.
But I need to use the old iostream.h. Is there a way to accomplish that? The reason is, that this project relies on an old static lib using the old iostream.h.
Any suggestions?
If you have source code relying on iostream.h, change it.
If you have source code that you absolutely cannot change, write iostream.h yourself:
#include <iostream>
using namespace std;
A static library cannot possibly rely on a header file. A header file is included by source code or other header files, the static library consists of object code. The library's header files can depend on iostream.h, though.
The library itself can depend on the C++ standard library.
I assume that there have been incompatible changes to Microsoft's standard library since MSVC 6.0, so if you do not have source code or a newer version of your static library, then you are probably out of luck.
Are you using precompiled headers? If so, then you'll have to include iostream.h within the stdafx.hfile or remove the precompiled headers. Anyway, there seems no reason using the deprecated iostream.h instead of iostream, so maybe you should change the parts of the code that need the old version (if so).
Replace
#include <iostream.h>
with
using namespace std;
#include <iostream>