Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 days ago.
Improve this question
Compiling with
g++ detect_version.cpp -o detect_version.exe
and running the following program:
int main()
{
std::cout << "Version is: " << __cplusplus;
return 0;
}
Gives me: "Version is: 201703" which is C++17 that should contain <view_string>
However if write
#include <view_string>
It gives me:
detect_version.cpp:3:10: fatal error: view_string: No such file or directory
3 | #include <view_string>
| ^~~~~~~~~~~~~
compilation terminated.
Under MSYS2 MinGW libstdc++ should be mingw-w64-x86_64-gcc-libs and from that I do have the latest version:
$ pacman -Q | grep mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-gcc-libs 12.2.0-10
What could be the problem?
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
It was working perfectly for others c file but in this file it fail to run . Please do explain , as i am new to Programming world.
C:\Desktop\C Basic\recursiveFunction> gcc .\pratice.c
PS C:\Desktop\C Basic\recursiveFunction> gcc .\a.exe
.\a.exe: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status
gcc is the compiler. You compile your program using gcc .\pratice.c. You can remove the .\ since gcc will look in the current directory for source files anyway.
You execute your compiled program using .\a.exe.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I'm running a .cpp file and trying to print out to the screen for debugging purposes, however my message does not appear. I'm running my program from the Linux Terminal using the following command:
g++ -m32 -static genConfig.cpp -o genConfig
All that my .cpp file should do at this point is cout to the terminal as show below. However the output doesn't appear.
#include <string>
using namespace std;
int main(int argc, char ** argv) {
cout<<"HEYYYA";
}
The command g++ -m32 -static genConfig.cpp -o genConfig does not run the application, it compiles (and links) it. In order to run the generated binary, you need to execute ./genConfig.
Also, you need #include <iostream> and actually #include <string> is not needed (at least not for this specific portion of code).
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I can't get integer from user, when i try cin >> n; (where n is int variable)
it gives some strange error. Other inputs like character, double float works fine.
I was using DevC++, but now I also tried it on command line gcc, the error is still there :
undefined reference to 'std::cin'
undefined reference to `std::istream::operator>>(int&)'
...
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
}
it works fine if I change n to a float type or double type variable.
Tried on Bloodshed DevC++,
MinGw gcc
Try with g++ :
g++ program.cpp -o a.out
Or with gcc (If you add the c++ runtime library) :
gcc program.cpp -o a.out -lstdc++
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have the following test.cpp file :
#include <unistd>
int main()
{
return 0;
}
I just want to compile this but I still have the following :
$ g++ test.cpp
test.cpp:1:18: fatal error: unistd: No such file or directory
#include <unistd>
^
compilation terminated.
I found unistd.h at /usr/include/unistd.h. and my $LD_LIBRARY_PATH environment variable was empty so I set it at /usr/include (with export LD_LIBRARY_PATH=/usr/include) but the problem remains.
What could I do?
The name of the header is unistd.h, not unistd. And LD_LIBRARY_PATH is used to locate shared libraries, not header files.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
it keeps telling me
gcc hello.cpp -o hello
gcc: error: hello.cpp: No such file or directory
gcc: fatal error: no input files
compilation terminated.
please anyone help
The source file needs to be in the same path you invoke gcc or you can put the full path in there
gcc /home/username/Desktop/hello.cpp
or you can do cd /home/username/Desktop then invoke gcc from that given path.
set your current directory where the .cpp file is