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.
Related
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
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?
I’m new to C++, only experienced in Java so far, so please be precise with the answers.
I translate the error from German to English, so they might not match the English counterpart.
I was trying to set up the IDE Codeblocks on Ubuntu, and tried to test it with a simple Hello World program.
Trying to "Build and run" the program caused two errors in the build log:
"-------------- Build: Debug in TestProject (compiler: GNU GCC Compiler)---
g++ -Wall -std=c++11 -g -c /home/marcel/Dokumente/Dokumente/Privat/Udemy/C++/Übung/TestProject/src/Main.cpp -o obj/Debug/src/Main.o
g++ -o bin/Debug/TestProject obj/Debug/src/Main.o
g++: error: obj/Debug/src/Main.o: File or directory not found
g++: fatal error: no input files
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))"
I tried to look it up, but most people seemed to have more problems than just these two files. None of their Solutions worked.
So far I've wasted a few days trying to fix it, so I thought I would ask here.
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.
Recently i installed Code Blocks, done all the linking after that i build and run the program it comes out error with "Process Terminated With Status 127". i tried several ways to solve it like build-essential, g++ but still can't solve it, please help`
-------------- Run: Release Win32 in DeepNeuralNetwork (compiler: GNU GCC Compiler)---------------
Checking for existence: /media/rnd/4F3D93242E986B7F/DeepNeuralNetwork/DeepNeuralNetwork/DeepNeuralNetwork
Executing: /media/rnd/4F3D93242E986B7F/DeepNeuralNetwork/DeepNeuralNetwork/DeepNeuralNetwork (in /media/rnd/4F3D93242E986B7F/DeepNeuralNetwork/DeepNeuralNetwork/.)
Process terminated with status 127 (0 minute(s), 0 second(s))
`