I was trying to compile my code in cpp (command is g++ ak.cpp , here "ak" is the name of my program) using terminal in ubuntu 16.04lts , but everytime I got a error of two lines i.e
/usr/bin/ld: cannot find crtn.o: no such file or directory
collect2: error: ld returned 1 exit status...
Related
When I try to train my yolov4 on my vm with command
./darknet detector train build/darknet/x64/data/obj.data cfg/yolov4-my_gray.cfg backup/yolov4-my_gray_1200.weights -gpus 0,1,2,3 -dont_show
I received
-bash: ./darknet: No such file or directory
Of course I do this in darknet directory. When I try to make i received
When i check open cv
pkg-config --cflags opencv
I received
"-I/usr/include/opencv"
Maybe somebody can help.
Seems compiler is not able to find the file in the includes path you mentioned.
First check if cuda_runtime.h file is available on your machine and get that location. If the file is available then just give the path of the file to the compiler using -I option.
If the file is available at the path /usr/include/opencv, then you would need to provide it with -I option to the compiler
g++ -std=c++11 -I/usr/local/cuda/include ...
I am trying to create a program using the libusb-1.0 library
After I installed the library when I try to compile like so
gcc -g main.c -o test.exe -lusb-1.0
i get the following error
gcc.exe: error: .0: No such file or directory
what do I have to type for the linkage option "-lusb-1.0" to be read properly
I am using mingw64 on Windows
This can be solved by adding single or double quotes around '-lusb-1.0'
for example here is the code i used to compile
gcc *.c -o test.exe '-lusb-1.0'
I recently installed a new SSD on my machine, and when I did a clean install of windows I got Visual Studio Code, and was about to get the c++ extension up and running, so I got MinGW, and tried to install the GCC and G++ compilers... And low and behold, after trying a lot of solutions, it is still not working properly on this computer image.
When I try to test the compiler after I got MinGW installed properly, this is what it output:
gcc.exe -Wp,-v -E -xc -dD -x c++ nul
ignoring nonexistent directory
"c:\mingw\bin\../lib/gcc/mingw32/6.3.0/../../../../mingw32/include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include/c++"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include/c++/mingw32"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include/c++/backward"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include"
ignoring duplicate directory
"/mingw/lib/gcc/mingw32/6.3.0/../../../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
ignoring duplicate directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include-fixed"
ignoring nonexistent directory
"c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include/c++
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include/c++/mingw32
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include/c++/backward
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/../../../../include
c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include-fixed
End of search list.
cc1plus.exe: fatal error: nul: No such file or directory
compilation terminated.
Error: 1
The odd part is that the cc1plus.exe is in the MinGW directory, and I even added it to the include path later to see if that would help, and still nothing. I'm not quite sure how to proceed.
This bug has become the bane of my existence for the last week. If anyone has any ideas I'd really appreciate the help. I've had success with MinGW in the past, but for some reason it's giving me problems this time.
Your commandline is:
gcc.exe -Wp,-v -E -xc -dD -x c++ nul
The error:
cc1plus.exe: fatal error: nul: No such file or directory
is the C++ compiler (cc1plus.exe) telling you that the input file nul
does not exist. That will be because there is no file called nul in the current directory.
The Windows CMD NUL device is a virtual device to which the output of a command may be
redirected ( command >NUL) to throw it away. It is not a file.
If you want to test that the compiler can be successfully invoked with this commandline,
then write a program such as:
main.cpp
int main()
{
return 0;
}
Save it in the current directory and run:
gcc.exe -Wp,-v -E -xc -dD -x c++ main.cpp
Close your IDE and go your program folder and open folder with your IDE. Then run and check to see if your problem is solved.
I have installed the cds library with command ./build.sh -b 64 -z '-std=c++0x' -l '-L /usr/lib/x86_64-linux-gnu' --with-boost /usr/include/boost --amd64-use-128bit at build folder.
After I tried to compile the example init.cpp of src folder, I typed this in terminal: g++ init.cpp -o init, and terminal showed: fatal error: cds/init.h: No such file or directory.
What should I do for compilation command in this case?
Thanks.
For general troubleshooting in cases like this, i would recommend finding where on the system the file got installed (if your build.sh actually installed the file). You would be able to find the missing header file using
find / -path '*/cds/init.h' 2>/dev/null
Then you need to supply two parameters to g++:
First one gets the compiler to know about the include files from the install directory
-I path_to_folder_one_step_above_cds_folder
Second one gets the linker to know about the librarys location. If the library file is called libcds.so, you can find it by running
find / -name libcds.so 2>/dev/null
So for linking, you supply the flag
-L path_to_folder_one_step_above_libcds.so
In your case you might not need the -L flag, since most of your library supposedly is header only.
UPDATE: the build.sh script is printing out important information at the top, starting with "Building with the following options:". The important bits will be "Compile options:" and "Link options:". Those should be enough to solve your specific option.
UPDATE2: build.sh also exports some flags which might include more options. You can print them out directly after running build.sh by running
echo LDFLAGS=$LDFLAGS
echo CFLAGS=$CFLAGS
echo CXXFLAGS=$CXXFLAGS
you are likely to need to pass all these options to g++ when compiling and linking against that library. LDFLAGS are specific to the linker only. Both the other ones are needed for compiling c++ files.
I'm using cygwin and gcc to create a new dll on Windows XP. I have an existing dll (MyCApi.dll) and example_wrap.o that I want to both use to create a new dll, example.dll. I ran the below gcc command and it looks like gcc can't find MyCApi.dll. I have the directory it lives in on my path. Is there something else I need to do?
$ gcc -shared example_wrap.o -mno-cygwin -Wl,--add-stdcall-alias -lMyCApi -o example.dll
/usr/bin/ld: cannot find -lMyCApi
collect2: ld returned 1 exit status
I'm not sure what you mean when you say it's on your path (LIBRARY_PATH?) but I suspect if you add
-L/directory/where/dll/lives
to the compilation line it'll work just fine.