CodeBlocks compile program for 32bit computer - c++

I'm trying to compile my code for a 32 bit system using CodeBlock default MinGW compiler adding the -m32 parameter, but I'm getting a lot of errors:
||=== Build: Debug in cONfuSioN (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lstdc++|
ld.exe||cannot find -lmingw32|
ld.exe||cannot find -lgcc|
ld.exe||cannot find -lgcc_eh|
ld.exe||cannot find -lmoldname|
ld.exe||cannot find -lmingwex|
ld.exe||cannot find -lmsvcrt|
ld.exe||cannot find -lpthread|
ld.exe||cannot find -ladvapi32|
ld.exe||cannot find -lshell32|
ld.exe||cannot find -luser32|
ld.exe||cannot find -lkernel32|
ld.exe||cannot find -liconv|
ld.exe||cannot find -lmingw32|
ld.exe||cannot find -lgcc|
ld.exe||cannot find -lgcc_eh|
ld.exe||cannot find -lmoldname|
ld.exe||cannot find -lmingwex|
ld.exe||cannot find -lmsvcrt|
||error: ld returned 1 exit status|
||=== Build failed: 20 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|
EDIT: I fixed

Most builds of mingw.org and mingw-w64 only support either 32-bit or 64-bit. There are entirely separate toolchain distributions for 32-bit target than for 64-bit target.
You can have two toolchains installed side by side, but not have one toolchain with target switches.
(I have heard of someone who did do a multi-target single toolchain distro of mingw-w64 but chances are that is not what you have got installed already).
It sounds like you have only installed a 64-bit target version. You could look into also installing a 32-bit target toolchain of mingw-w64.

Related

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

Cannot find -lfreeglut codeblocks

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?

CodeBlocks no such file, no input files error, using GCC cygwin compiler

I have installed code blocks on Windows 10, before that I installed GCC Cygwin compiler.
In Settings > Toolchain executables section I set up C compiler, C++ compiler,
linker to dynamic libs to use gcc.exe, the compiler's directory is set as C:\cygwin64.
I tried to run a dummy hello world program to make sure it works but got the following error:
||=== Build: Debug in dummy2 (compiler: Cygwin GCC) ===|
\Users\abc\OneDrive\ミミクミケ ムath\dummy2\main.c"||No such file or directory|
||error: no input files|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I used to use min gw compiler and it worked fine, but once I switched to cygwin it started to throw errors.
It looks like this part of the file directory is garbled, cant figure out why.
OneDrive\ミミクミケ ムath\
Please let me know what can be a problem here.
Cheers.

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,

Mingw-w64 + codeblocks : No such file or directory

I have installed mingw-w64 to have a 64-bits compiler. I used Code Blocks as IDE and i had before a 32 bits mingw which is working very well. My OS is windows 8.1.
I have followed this tutorial : https://www.youtube.com/watch?v=1nsjGxy1w0U
And the problem I have is this :
||=== Build: Release in uvgen (compiler: GNU GCC Compiler (x64)) ===|
F:\Document\c++\uvgen\main.cpp|11|fatal error: GL/glut.h: No such file
or directory| ||=== Build failed: 1 error(s), 0 warning(s) (0
minute(s), 0 second(s)) ===|
I put ( the files opengl, glut and glu from my 32bit-compiler):
glut32.dll and opengl32.dll in mingw64/bin
GL/glut.h and others in mingw64/include
and the libs in mingw64/lib
But my 64bits compiler don't find them :(
Thank you for helping me.
The error message indicates that mingw cannot find GL/glut.h. For you compiler
to find it you either specify an include path -L PATH_TO/GL/glut.h on the compile command or
by placing the files in the default include paths.
You can dump the default include paths with g++ -E -x c++ - -v
I got that from Dump include paths from g++.
If that doesn't help search for how to dump default include paths in mingw. You can
always use -L option.