Cannot find -lfreeglut codeblocks - c++

I just tried to setup freeglut in my codeblocks 20 64-bit pre-packaged mingw-gnu-compiler, following popular youtube tutorials,
I created the glut project in codeblocks, and tried to compile, it gives error
||=== Build: Debug in SnakeGame (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lfreeglut|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|
What's wrong?

Related

Link to comebaseapi.h from Mingw

I found a code in internet in order to read the serial number from a USB pen drive. It uses the windows API. I use MINGW, compiler on Codeblocks ide.
There are two API:
CoUninitialize();
and
CoCreateInstance(CLSID_WbemLocator, 0,
CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc);
that are defined on comebaseapi.h,that I included, but the compiler cannot find the reference :
||=== Build: Debug in Dongle (compiler: GNU GCC Compiler) ===|
obj\Debug\clHw.o||In function `clHw::~clHw()':|
C:\Users\jurha\Documents\codeblocksprojects\Dongle\clHw.cpp|39|undefined reference to `__imp_CoUninitialize'|
obj\Debug\clHw.o||In function `clHw::GetWbemService(IWbemServices**)':|
C:\Users\jurha\Documents\codeblocksprojects\Dongle\clHw.cpp|86|undefined reference to `__imp_CoCreateInstance'|
||error: ld returned 1 exit status|
||=== Build failed: 14 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I found on stackoverflow that I have to link ole32.dll, but Codeblocks allow me to link only .lib, so I search for ole32.lib, I copied it and pasted in the same folder of the project and I linked it, but than it gives me the follow error:
||=== Build: Debug in Dongle (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lOle32.Lib|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
It cannot find the library.
Someone can help me

Setting up SFML in Codeblocks cant find "-lsfml-graphics"

I tried installing sfml on windows in codeblocks using c++ by following the tutorial in their website and also by following tutorials on the web but even after all that it doesnt work and it gives out this error:
||=== Build: Debug in dasg (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lsfml-graphics-s|
ld.exe||cannot find -lsfml-window-s|
ld.exe||cannot find -lsfml-system-s|
ld.exe||cannot find -lfreetype|
||error: ld returned 1 exit status|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
In my compiler settings i have in the #define tab writen "SFML_STATIC"
In the linker setting i have the following link libraries
sfml-graphics-s
sfml-window-s
sfml-system-s
opengl32
freetype
gdi32
winmm
In the search directories in the compiler sub tab i have the path to my sfml/include folder and in the linker subfolder I have the path to my sfml/lib
Did i do something wrong or did i forget something?
First check do you have a static or dynamic version of your library.
In your library path check the files in /lib folder. if they have extension .so for example libsfml-graphics.so .
Go with this tutorial -> https://www.sfml-dev.org/tutorials/2.5/start-cb.php

error: ld returned 1 exit status - codeblocks

I downloaded the source of a small openGL project but when i try to compile it gives me this error message ("error: ld returned 1 exit status") and i dont know how to fix it. Does anyone know what it means?
The program uses openGL with GLFW 2.
Here's the build log:
-------------- Build: Debug in Procedurus (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -L"C:\Program Files (x86)\CodeBlocks\MinGW\lib" -L"C:\Program Files (x86)\CodeBlocks\MinGW\lib" -o bin\Debug\Procedurus.exe obj\Debug\Application\TextTool.o obj\Debug\Geometry\AstronomicalObject.o obj\Debug\Geometry\Atmosphere.o obj\Debug\Geometry\CloudLayer.o obj\Debug\Geometry\Frustum.o obj\Debug\Geometry\Geometry.o obj\Debug\Geometry\Particle2D.o obj\Debug\Geometry\Planet.o obj\Debug\Geometry\PlanetRing.o obj\Debug\Geometry\QuadtreeTerrain\QuadtreeTerrain.o obj\Debug\Geometry\QuadtreeTerrain\QuadtreeTerrainFace.o obj\Debug\Geometry\QuadtreeTerrain\QuadtreeTerrainNode.o obj\Debug\Geometry\QuadtreeTerrain\QuadtreeTerrainPatch.o obj\Debug\Geometry\QuadtreeTerrain\QuadtreeTerrainPatchTopology.o obj\Debug\Geometry\QuadtreeTerrain\RidgedMultifractalSphericalQuadtreeTerrain.o obj\Debug\Geometry\QuadtreeTerrain\SphericalQuadtreeTerrain.o obj\Debug\Geometry\SimpleCircle.o obj\Debug\Geometry\SimpleCylinder.o obj\Debug\Geometry\SimpleDisk.o obj\Debug\Geometry\SimpleSphere.o obj\Debug\Geometry\Skybox.o obj\Debug\Geometry\Star.o obj\Debug\Geometry\Starfield.o obj\Debug\GL\GLee.o obj\Debug\Math\Randomizer.o obj\Debug\ProcedurusMain.o obj\Debug\Shaders\ShaderManager.o -lopengl32 -lglfw -lglu32 -lgdi32 -lGLFW GL/glfw
GL/glfw: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
So the problem is with the file named "glfw" but if i delete it and keep only the glfw.h it gives me another error ("mingw32-g++.exe: error: GL/glfw: No such file or directory
")
I can upload the project if that helps.
You have an extra GL/glfw in your compile command, you should delete this, it is not necessary.

codeblocks doesn't work on windows 8 or 8.1

I really need your help. I just purchased a new laptop, it has windwos 8 operating system, and I am trying to practice my c++ code, but it gives me error and doesn't output. Please help...
Here is what I get when I run simple "Hello world" program.
||=== Build: Debug in codeblocks_testing (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lsndfile|
ld.exe||cannot find -lglew|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|
Thanks in advance,

Boost threads creating InterlockedCompareExchange Errors on mingw32

After googling for InterlockedCompareExchange errors, it seems like it always points to an old error for mingw64, and I am using mingw32.
It seems to happen to all examples that use threads, but if I just have "#include <boost/thread.hpp>" and no calls of a thread it will work, so I think I did the linking correct.
This is my build:
-------------- Build: Debug in UDP_EXAMPLE (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -D_WIN32_WINNT=0x0501 -g -IC:\boost_1_56_0 -c "C:\Users\poteto\Desktop\Other Programming\UDP_EXAMPLE\server.cpp" -o obj\server.o
In file included from C:\boost_1_56_0/boost/thread/win32/thread_data.hpp:11:0,
from C:\boost_1_56_0/boost/thread/thread_only.hpp:15,
from C:\boost_1_56_0/boost/thread/thread.hpp:12,
from C:\boost_1_56_0/boost/thread.hpp:13,
from C:\Users\poteto\Desktop\Other Programming\UDP_EXAMPLE\server.cpp:5:
C:\boost_1_56_0/boost/thread/win32/thread_primitives.hpp:180:0: warning: ignoring #pragma intrinsic [-Wunknown-pragmas]
mingw32-g++.exe -o Debug\http_server.exe obj\server.o -lws2_32 -lwsock32 C:\boost_1_56_0\stage\lib\libboost_thread-mgw47-mt-1_56.a C:\boost_1_56_0\stage\lib\libboost_system-mgw47-mt-1_56.a
C:\boost_1_56_0\stage\lib\libboost_thread-mgw47-mt-1_56.a(thread.o):thread.cpp:(.text$_ZN5boost6detail5win3223GetTickCount64emulationEv+0x1e): undefined reference to `_InterlockedCompareExchange'
C:\boost_1_56_0\stage\lib\libboost_thread-mgw47-mt-1_56.a(thread.o):thread.cpp:(.text$_ZN5boost6detail5win3223GetTickCount64emulationEv+0x70): undefined reference to `_InterlockedCompareExchange'
C:\boost_1_56_0\stage\lib\libboost_thread-mgw47-mt-1_56.a(thread.o):thread.cpp:(.text$_ZN5boost6detail5win3223GetTickCount64emulationEv+0xb5): undefined reference to `_InterlockedCompareExchange'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 11 second(s))
3 error(s), 1 warning(s) (0 minute(s), 11 second(s))
I linked the libraries: libboost_thread and libboost_system. I am using Codeblocks. Other asio examples without threads work.
In the example:http://www.ce.unipr.it/~medici/udpserver2.html
If I were to remove the call to the thread, it would work.