I'm starting to code in Code::Blocks and I need a compiler, I installed Digital Mars at C:/dm and selected it in Code:Blocks. The sc.ini of C:/dm/bin looks like this:
[Version]
version=7.51 Build 020
[Environment]
PATH=%PATH%;"%#P%\..\bin"
BIN="%#P%\..\bin"
INCLUDE="%#P%\..\stlport\stlport";"%#P%\..\include";"%#P%\..\mfc\include"
;%INCLUDE%
;INCLUDE="%#P%\..\include";"%#P%\..\mfc\include";%INCLUDE%
LIB="%#P%\..\lib";"%#P%\..\mfc\lib";%LIB%
HELP="%#P%\..\help"
but when compiling I always get this error:
||=== Build: Debug in Serevr (compiler: Digital Mars Compiler) ===|
||unable to open input file 'iostream'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I looked at other posts but none helped! does anyone know how to fix this?
I suppose the file has been edited by you. BIN and INCLUDE will most likely not work if on the same line - insert a newline before INCLUDE:
BIN="%#P%\..\bin"
INCLUDE="%#P%\..\stlport\stlport";"%#P%\..\include";"%#P%\..\mfc\include";%INCLUDE%
;INCLUDE="%#P%\..\include";"%#P%\..\mfc\include";%INCLUDE%`
and try again.
Also, did you download and install the STLport? As the iostream header comes from there for DM. Check also the stlport include, the "%#P%\..\stlport\stlport" entry seems somewhat dubious - depending where you installed it, it could be only "%#P%\..\stlport" (i.e. check if the iostream header is really in the C:\DM\stlport\stlport or just in C:\DM\stlport or maybe even in C:\DM\stlport\include or somewhere alike).
Besides, the Digital Mars compiler could be somewhat tricky in my experience (e.g. not supported by CMake AFAIK), you might want to try the MinGW (GCC) compiler, which is more up to date and likely better supported by various tools.
(or the MS Visual Studio Express, which is native on Windows and comes with the IDE)
Related
im having problem when compiling C++ source code. that code is a keylogger. at first, i save with .cpp, and try to compile it from terminal using this command
g++ test.cpp
and then the terminal showed me this messages
test.cpp:1:10: fatal error: conio.h: No such file or directory
#include <conio.h>
^~~~~~~~~
compilation terminated.
and this message
test.cpp:2:10: fatal error: windows.h: No such file or directory
#include <windows.h>
^~~~~~~~~~~
compilation terminated.
to fix this, i tried to use a C++ IDE, code::blocks. installed from terminal, and the copy that keylogger source code to code:::blocks. but the IDE shows this message
||=== Build file: Debug in Belajar CPP (compiler: GNU GCC Compiler) ===|
/home/lucky/test.cpp|1|fatal error: conio.h: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I just don't know how to fix this and how to search the solutions online. because I'm new in using Linux-Mint. Can someone help me to fix this?
First of all, conio.h and windows.h these headers are not supported on linux console.
Alternative is to use NCurses library. It does all the Console realted stuff you could want and is part of the Linux Standard Base ( i.e. available in every distro ).
Include 'ncurses.h' instead.
I hope this will resolve your issue.
I have just started learning programming, and I am facing troubles adding libraries ( Other than STD libraries) in my programs.
I use codeblocks IDE and I wanted to add a library CImg from the internet.
After reading many threads I have done the following steps however I still get an error loading one of the examples provided CImg people
Downloaded Cimg folder which has a Cimg.h file along with other example files.
Unzip the folder to E drive.
open code blocks>compiler settings(gnu gcc compiler)>search libraries
under search libraries I have compiler tab and linker tab where I have added the path of the downloaded folder.
next when I open an example provided by the developer, build and run it.
The cimg.h file open up and I get the following error:
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
E:\programming\cpp programming\CImg-2.0.0_pre012317\CImg.h||In function 'int cimg_library::cimg::fseek(FILE*, INT_PTR, int)':|
E:\programming\cpp programming\CImg-2.0.0_pre012317\CImg.h|5617|error: '_fseeki64' was not declared in this scope|
E:\programming\cpp programming\CImg-2.0.0_pre012317\CImg.h||In function 'INT_PTR cimg_library::cimg::ftell(FILE*)':|
E:\programming\cpp programming\CImg-2.0.0_pre012317\CImg.h|5626|error: '_ftelli64' was not declared in this scope|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 10 second(s)) ===|
Please help me out, Also kindly explain to me what I am doing as I have no idea.
EDIT: As pointed out to me in the comments I have changed my compiler to TDM-GCC MinGW 64 bit compiler.
But now I get a different type of error, is it because I havent installed the compiler properly because I can run hello world using this compiler.
the error that i get is :
||=== Build: Debug in hello (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function cimg_library::CImgDisplay::paint()':|
E:\programming\cpp programming\hello\..\CImg-2.0.0_pre012317\CImg.h|9696|undefined reference to__imp_SetDIBitsToDevice'|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Finally I have found out what were my mistakes and how to correct them.
I was using a 32 bit compiler, So I switched to one for 64 bits.
After that I had not linked gdi32 library. So when I went to linker settings and added gdi32 to linked libraries evrything started to work.
Thank you for helping me out.
Hi Guy's looking for some help and can't understand the problem. I'm following this tutorial https://www.binpress.com/tutorial/creating-a-city-building-game-with-sfml-part-8-gui-system/130, I'm using CodeBlocks 13.12 and SFML 2.1 but when I try to compile the code I get this
||=== Build: Debug in Test (compiler: GNU GCC Compiler) ===|
C:\Users\James\Desktop\Summer Repeats 2015\Games Dev 2\Test\src\Game_State_Start.cpp||In constructor 'GameStateStart::GameStateStart(Game*)':|
C:\Users\James\Desktop\Summer Repeats 2015\Games Dev 2\Test\src\Game_State_Start.cpp|100|error: 'class std::map<std::basic_string<char>, Gui>' has no member named 'emplace'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
This is the line of code giving me this error.
this->guiSystem.emplace("menu", Gui(sf::Vector2f(192, 32), 4, false, game->stylesheets.at("button"),
{ std::make_pair("Load Game", "load_game") }));
I have CodeBlocks set for C++11 and change SFML to SFML-2.3.1-windows-gcc-4.9.2-mingw-32-bit because I found here saying I have to use g++ 4.8.0 or higher on this page std::map emplace gcc 4.8.2, but still getting the same error, also the website give's me the code to download even though I'm trying to follow it myself , I checked the code, importing into a new project and that didn't work either, So no idea whats wrong. Any help or a point in the right direction would be most appreciated.
Normally I would post this in a comment but I don't have enough rep.
Start a new project and compile and run this code:
#include <iostream>
#include <ostream>
int main()
{
std::cout << __cplusplus << std::endl;
}
If the result printed out is 199711, then it means you're not compiling using the -std=c++11 option. If the result printed out is 201101 then it means you're using an outdated version of the standard library.
Found the solution. I had originally installed codeblocks-13.12mingw-setup, I uninstalled this and installed codeblocks-13.12mingw-setup-TDM-GCC-481. It works now. Thanks for everybody's help.
I try to compile a program
program test
integer,parameter :: p6 = selected_real_kind(6)
end program test
using gfortran and code::blocks. But i recieve an error message in build log window:
f951.exe: internal compiler error: Illegal instruction
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
What is wrong with my code or settings? Thanks for any help!
So, it looks like OP is currently using a rather old build of a development version, thus, I'm not surprised OP have an internal compiler error. From my experience I recommend builds from MinGW-w64, say mingw-builds, which can be downloaded from here (generate binaries for 32-bit Windows) or here (generate binaries for 64-bit Windows).
There are few different variants of the mingw-builds. For 32-bit case I recommend to go with POSIX threads & DWARF exception handling variant, while for 64-bit case - POSIX threads & SEH exception handling variant.
P.S. Currently I would not recommend GCC 5 for working with a large code base, since I experienced few internal compiler errors with it. GCC 4.9.2 is a much safer bet right now.
i'm getting a peculiar issue when trying to compile my program. I don't have a huge ammount of experience with C++. I'm trying to simple create a function that can FTP put a file upto my plain FTP server. I'm using codeblocks IDE, and the GNU GCC compiler, and in the end, i thought to try a full fledged example i found online to test if it was me writing some silly code. I have installed the windows SDK with all libs, so i can confirm the files are present, and if i build without any code, there is no linker errors.
I copied the OP's code, as it looked fine, and he complained of no such issues.
http://social.msdn.microsoft.com/Forums/en-US/76eb8b89-4b96-41ba-b869-e30711f29256/ftpputfile?forum=vcgeneral
However when i attempt to build my project, i get a plethora of errors:
||=== Build: Debug in uploader (compiler: GNU GCC Compiler) ===|
C:\C++\uploader\main.cpp||In function 'void FileSubmit()':|
C:\C++\uploader\main.cpp|10|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\C++\uploader\main.cpp|11|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\C++\uploader\main.cpp|12|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
obj\Debug\main.o:main.cpp|| undefined reference to `InternetOpenA#20'|
obj\Debug\main.o:main.cpp|| undefined reference to `InternetConnectA#32'|
obj\Debug\main.o:main.cpp|| undefined reference to `FtpPutFileA#20'|
obj\Debug\main.o:main.cpp|| undefined reference to `InternetCloseHandle#4'|
obj\Debug\main.o:main.cpp|| undefined reference to `InternetCloseHandle#4'|
||=== Build failed: 5 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|
Any idea what i'm doing wrong here? Do i need to be using certain compiler settings?
For anyone else experiencing this problem.
The solution to this, as implied by Igor in the commends on the op, was too manually add a link to the lib. In code blocks, this is accomplished by going to project --> Build Options, click the linker tab, and then manually browse to the file and include it. This has now made my project compile. Why code blocks requires this I don't know. But it does, so thanks Igor.