Well, i did all i knew to work with allegro in C++ but i keep getting the same problem,
-lalleg not found
D:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible D:\Program Files (x86)\Dev-Cpp\MinGW64\lib/liballeg.a when searching for -lalleg
D:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe skipping incompatible D:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../liballeg.a when searching for -lalleg
D:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\bin\ld.exe cannot find -lalleg
E:\Programacion\C++\Practicas\Allegro\Testing\collect2.exe [Error] ld returned 1 exit status
i tried to make DevC++ to send the -lalleg at compiling but i keep getting that
,if i don't put the compiler to use -lalleg
i get this
D:\Users\J****n\AppData\Local\Temp\ccz9vWbS.o In function `_mangled_main()':
4 E:\Programacion\C++\Practicas\Allegro\Testing\Main.cpp undefined reference to `_install_allegro_version_check'
D:\Users\J****n\AppData\Local\Temp\ccz9vWbS.o In function `WinMain':
7 E:\Programacion\C++\Practicas\Allegro\Testing\Main.cpp undefined reference to `_WinMain'
E:\Programacion\C++\Practicas\Allegro\Testing\collect2.exe [Error] ld returned 1 exit status
any of you know of any possible solution
i'm using Allegro 4.2.2 and the last version of DevC++
the code is something basig ,just a test
int main(){
allegro_init();
return 0;
}
END_OF_MAIN();
any help is welcome,thank you for the time
Related
I'm trying to setup SDL graphics for my project, and I tried to run it after I was almost complete, but then I got this error:
g++ -o dist/Debug/Cygwin-Windows/project_2_snake build/Debug/Cygwin-Windows/main.o -L../../../../../../../../../SDL2/lib -lmingw32 -lsdl2main -lsdl2
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingw32
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:63: dist/Debug/Cygwin-Windows/project_2_snake.exe] Error 1
Can anyone could help me with this?
Additional information
windows 10 i think
Cygwin c++ compiler
Your linker does not know where to find the library you are referencing.
You will have to tell it where to find it. The easiest solution would likely be to add the libs directories of the libraries you are referencing to your linker's search directories.
I just build the following package: faiss and my cpp program now recognises all library header so I can include them into my program. But my programm throws undefined reference to. So when I built faiss it created a libfaiss.a and a libfaiss.so which one to link and how??? I think I have tried any solution that I could find in the internet, but my knowledge of the build/linking process is limited.
My Faiss build-directory looks like this:
faiss-1.5.3/
-libfaiss.a
-libfaiss.so
-foo.h
-foo.o
-foo.cpp
-bar.h
-...
My tries. (I am using ROS, catkin_simple and gtests)
So this is how I would usually do it:
find_library(LibFaiss faiss HINT /home/tim/faiss/faiss-1_5_3/faiss-1.5.3/)
catkin_add_gtest(test_inverted_nn test/test_inverted-nn.cc
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}})
target_link_libraries(test_inverted_nn ${LIBRARY_NAME} ${LibFaiss})
I get the following Error:
/usr/bin/ld: cannot find -lLibFaiss-NOTFOUND}
collect2: error: ld returned 1 exit status
CMakeFiles/test_inverted_nn.dir/build.make:358: recipe for target '/home/tim/catkin_ws/devel/lib/nn/test_inverted_nn' failed
make[3]: *** [/home/tim/catkin_ws/devel/lib/inverted_nn/test_inverted_nn] Error 1
I also found this Solution here Import an external library into a ROS node, but that does not work for me:
add_library(libfaiss STATIC IMPORTED)
set_target_properties(libfaiss PROPERTIES IMPORTED_LOCATION /home/tim/faiss/faiss-1_5_3/faiss-1.5.3/libfaiss.a)
target_link_libraries(test_inverted_nn ${LIBRARY_NAME} ${libfaiss})
This throws the following Error:
/usr/bin/ld: cannot find -l}
collect2: error: ld returned 1 exit status
EDIT
After correcting the not_found error I am getting the following error:
CMake Warning at /opt/ros/melodic/share/catkin/cmake/test/gtest.cmake:180 (add_executable):
Cannot generate a safe runtime search path for target
test_inverted_multi_index because files in some directories may conflict
with libraries in implicit directories:
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
Some of these libraries may not be found correctly.
*** It does not matter what I add inside target_link_libraries I am always getting that error***
EDIT2
So with the tipp of #Aconcagua I deleted everything from the CMakeLists.txt and only added the following to my cmake options:
-DCMAKE_CXX_FLAGS=-L/home/tim/faiss/faiss-1_5_3/faiss-1.5.3/
But Im still getting the undefined reference errors. It does not make any difference
I'm trying to use MingGW on Windows but when I try to compile my c/c++ files, following error occurs when I compile with C(gcc)
> gcc c:\Users\Administrator\Desktop\C_C++\helloworld\hello.c - o c:\Users\Administrator\Desktop\C_C++\helloworld/hello
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc_eh
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc_eh
collect2.exe: error: ld returned 1 exit status
and following error occurs when I compile with C++(g++)
> g++ c:\Users\Administrator\Desktop\C_C++\helloworldcpp\hello.cpp -o c:\Users\Administrator\Desktop\C_C++\helloworldcpp/hello
g++.exe: error: CreateProcess: No such file or directory
The path variable is C:\MinGW\bin . I've downloaded mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++ and msys-base among the basic setup packages. Also I'm getting #include error for iostream. I've tried almost all of the methods out in the internet but couldn't fix.
It seems like MinGW wasn't installed correctly.
Re-installing it will likely fix the issue.
I'm trying to install libcurl for Bloodshed Dev C++ but I'm running into a couple of issues.
I've included the curl directory under Dev-Cpp\MinGW\include and have placed the library files (which I compiled myself using MinGW) in the Dev-Cpp\MinGW\lib directory. I have added all the libraries I'm using to the Linker tab under Project> Project Options> Parameters.
Here is the code I'm using to test libcurl:
#define CURL_STATICLIB
#include "curl/curl.h"
#include <stdio.h>
#include <stdlib.h>
int main(void) {
CURLcode ret;
CURL *curl = curl_easy_init();
if (curl == NULL) {
fprintf(stderr, "Failed creating CURL easy handle!\n");
exit(EXIT_FAILURE);
}
/*Attempt to get Facebook*/
ret = curl_easy_setopt(curl, CURLOPT_URL, "http://www.facebook.com");
if (ret != CURLE_OK) {
fprintf(stderr, "Failed getting http://www.google.com: %s\n",
curl_easy_strerror(ret));
exit(EXIT_FAILURE);
}
ret = curl_easy_perform(curl);
if (ret != 0) {
fprintf(stderr, "Failed getting http://www.google.com: %s\n",
curl_easy_strerror(ret));
exit(EXIT_FAILURE);
}
return 0;
}
Now, the error enter code hereI'm getting is this:
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.dll when searching for -lcurlskipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib\libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib/libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib/libcurl.dll when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib\libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../libcurl.dll when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../..\libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/libcurl.dll when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib/libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../lib/libcurl.dll when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../libcurl.a when searching for -lcurl
skipping incompatible C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../libcurl.a when searching for -lcurl
cannot find -lcurl
[Error] ld returned 1 exit status
recipe for target 'Test.exe' failed
I am thoroughly stuck, and would deeply appreciate someone calling me an idiot and telling me what I'm doing wrong.
"skipping incompatible" usually indicates a architecture mismatch. A wild guess is that you should add -m32 in your compile flags. (or -m64, but judging from the installation path -m32 looks more likely.)
(Unrelated to the question, but I can't help but notice that your code is requesting facebook.com and printing a error mentioning google.com.)
I've solved the issue by switching to Codeblocks, using a different distribution and following the tutorial listed below.
Using LibCURL C++
I have one question about SDL compile, I use DEV C++ compiler a SDL program, but there is a error, the error log:
d:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDLmain
d:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe cannot find -lSDL
d:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\bin\ld.exe cannot find -lobjc
D:\C++\SDL\collect2.exe [Error] ld returned 1 exit status
I learn it from : http://tjumyk.github.io/sdl-tutorial-cn/lessons/lesson01/windows/devcpp/index.html
I completely followed the course step by step to install and config ,but it doesn't compile.