cannot run compiled c++ executable on OSX, works on Debian [closed] - c++

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
i have a c++ program contained in a single file, movie2serial.cpp. i am compiling the program using g++ with the following command:
g++ -std=c++0x -lstdc++ -lpthread -lboost_system movie2serial.cpp -o movie2serial
this produces an executable called movie2serial. on Debian Wheezy (running on a Raspberry Pi) i have no trouble running this executable. however, i just tried to compile the same program on OSX, using the same call to g++. i tried ./movie2serial and open ./movie2serial from the appropriate directory but these commands just return the following error:
open: No such file or directory
when i run file ./movie2serial it returns this:
./movie2serial: Mach-O 64-bit executable x86_64
why can't i execute my program?

Looks like your compilation failed.
Try executing the command below and check whether you have a file named movie2serial.
ls -al
When I try to compile using the command line options that you have given, it gives me the following error with -lboost_system.
ld: library not found for -lboost_system

Related

Why I get CUDA initialization failure with error 2? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 days ago.
Improve this question
I have project, that builds and runs inside of docker container on my machine, and it works without any errors. I work with video and everything works as expected. But when I build it with fsanitize, it throws:
ERROR: CUDA initialization failure with error 2. Please check your CUDA installation: http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Flags that use:
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
CUDA is installed both on host computer and inside of container. Any ideas?

How to debug a g++ segmentation fault using gdb? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I got a segfault when running my program. Then I googled my question and tried to follow steps from https://www.gnu.org/software/gcc/bugs/segfault.html.
I did not configure GCC with --enable-checking then my first question is -
1) is it necessary to configure it and compile with -v -da -Q ?
But I always do compile with flags such as -g -o0. After running the program in GDB with arguments I get this:
2) I can not print variables after segfault, is it okay ?
3) How to figure out the line of my source code where segfault happens ?
Then I googled my question and tried to follow steps from > https://www.gnu.org/software/gcc/bugs/segfault.html.
These are the steps for GCC developers to follow when GCC itself crashes while compiling your program.
These are not the steps you should follow when debugging a crash in the program itself.
Instead, read this.
How to figure out the line of my source code where segfault happens ?
GDB told you the line: it's common/search.cpp line 172.

Run an executable after moving it to a different directory in the make file [closed]

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
In my make file I try to move my executable to a different release directory and then run the program but I am having some issues when I run the program from the make file
mv main ../Data/Derived/Release;
./Data/Derived/Release/main
I get the command not found error.
When I go to the release folder and run ./main From the command line, it works as expected. I am not sure what I am missing here.
You moved the program to ../Data/Derived/Release.
Then you tried to run ./Data/Derived/Release.
These are not the same path. .. means "the parent directory", but . means "this directory".
Looks like you missed out a dot.

g++: CreateProcess: No such file or directory [duplicate]

This question already has answers here:
MinGW error: No such file or directory exists [closed]
(3 answers)
Closed 8 years ago.
System:
g++ version: g++ (TDM-2 mingw32) 4.4.1
windows 7 32 bit
Env path: C:\Python33\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Dwimperl\perl\bin;C:\Dwimperl\perl\site\bin;C:\Dwimperl\c\bin;C:\Program Files\QuickTime\QTSystem\;C:\Cygwin\bin;C:\Program Files\CodeBlocks\MinGW\bin;
Error:
C:\Program Files\CodeBlocks\MinGW\bin>g++ -o first.exe D:\first.cpp
g++: CreateProcess: No such file or directory
I took look on similar questions on SO, but none of them have answers for me.
Per one suggestion, I added Mingw, path to env variable path, as seen above.
Update: First I never believed this, but this worked for me.
MinGW error: No such file or directory exists
This error is most likely caused by a problem with PATH. I suspect that in your case g++ tries to run some utility in PATH, but fails, because of error in PATH, or because wrong g++ is executed with given parameters. For example, you might have some tool in C:\Cygwin\bin.
If that helps anybody, my case for the error was invalid slash in PATH, which was set as:
set PATH=%PATH%;"E:\godot.src\.locally/mingw32\bin"
Replacing the last entry in PATH with the stuff below fixed that:
E:\godot.src\.locally\mingw32\bin

Fatal Error while Running c++ object file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have compiled C++ project using cmake utility on Red hat Linux 4.1.2.
gcc version: 4.1
When I try to run object file using following command I got an exception:
./GCVMP ../../dat/settlingsUnix/MPSettings.xml
exception : Fatal Error: æ¹¥åSä
I am not able to understand root cause.
Please help me in this regard.
I suspect that the "Fatal Error:" portion is something printed by your code. It's supposed to be followed by a message explaining the error, but the message passed is corrupted, and so junk is printed.
Have you tried compiling the program with -ggdb running it under gdb? Here's a good starter on how to use the debugger: http://www.ibm.com/developerworks/library/l-gdb/