Mingw-w64 + codeblocks : No such file or directory - c++

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.

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

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.

“No such file or directory found” when building a project in CodeBlocks

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.

CODE::BLOCKS - why path is incorrect?

I am trying to configure project in CODE::BLOCKS according this tutorial:
Playing with OpenCL: Gaussian Blurring by Lefteris
I have set linking to
C:\Program Files\AMD APP\lib\x86\OpenCL.lib
and
W:\___NEW PROJECTS\GaussianBlur\Gaussian_with_OpenCL\refu.dll
libraries
Compiler Search folder to:
C:\Program Files\AMD APP\include\CL
and Search directories Linker folder to
C:\Program Files\AMD APP\lib\x86\
Now I run this code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
And I got these errors:
||=== Build: Debug in Gaussian_with_OpenCL (compiler: GNU GCC Compiler) ===|
[b]Files\AMD[/b]||No such file or directory|
[b]Files\AMD[/b]||No such file or directory|
[b]PROJECTS[/b]\GaussianBlur\Gaussian_with_OpenCL\refu.dll||No such file or directory|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
Why the path is incorrect and does not correspond with the data saved in settings of project?
Code::Blocks v13.12 running on Windows XP
Edit:
After I added quotes I have these errors:
mingw32-g++.exe -L"C:\Program Files\AMD APP\lib\x86\" -o bin\Debug\Gaussian_with_OpenCL.exe obj\Debug\main.o -lOpenCL "C:\Program Files\AMD APP\lib\x86\OpenCL.lib" -lrefu.dll "C:\Program Files\AMD APP\lib\x86\OpenCL.lib" "W:\___NEW PROJECTS\GaussianBlur\Gaussian_with_OpenCL\refu.dll"
mingw32-g++.exe: error: Files\AMD: No such file or directory
mingw32-g++.exe: error: APP\lib\x86\OpenCL.lib -lrefu.dll C:\Program: Invalid argument
mingw32-g++.exe: error: Files\AMD: No such file or directory
mingw32-g++.exe: error: APP\lib\x86\OpenCL.lib W:\___NEW: Invalid argument
mingw32-g++.exe: error: PROJECTS\GaussianBlur\Gaussian_with_OpenCL\refu.dll: No such file or directory
No quotes help in any form. This is nothing to do with spaces but with length of the file name. Compiler sees it as old MS-DOS in form of 8 characters as for name of file and 3 characters for extension. Any longer file name/folder must be renamed.
Solution:
1. go to the directory you need to get the real name of
Create link to command.com; working path filed stays empty
2. submit
3. run command.com in the folder
4. in command prompt type dir
5. select the text and copy it to clipboard by enter
6. edit the text as needed and paste it to the Code::Block
Here are examples of my paths:
C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib
(shortcut for C:\Program Files\AMD APP\lib\x86\OpenCL.lib )
W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
(shortcut for W:\___NEW_PROJECTS\GaussianBlur\Gaussian_with_OpenCL\refu.dll)
So now it works and errors disappear. I hope this helps to others.

'O_RDONLY', `F_SETFL`, 'O_NONBLOCK' undeclared errors while following OpenGL tutorial

I am currently learning modern OpenGl from the following website: http://www.arcsynthesis.org/gltut/Building%20the%20Tutorials.html.
Unfortunately, when I follow the instructions to build the code examples, I fail.
This is what happens:
1- I run premake4 codeblocks in the glsdk directory.
2- I open glsdk.workspace in code blocks.
3- I go to Build -> Build workspace.
4- I get the error:
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c In function ‘fghJoystickOpen’:|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c|1430|error: ‘O_RDONLY’ undeclared (first use in this function)|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c|1430|note: each undeclared identifier is reported only once for each function it appears in|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c|1448|error: ‘F_SETFL’ undeclared (first use in this function)|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c|1448|error: ‘O_NONBLOCK’ undeclared (first use in this function)|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c||In function ‘fghJoystickInit’:|
/home/hani/Desktop/Tutorial 0.3.8/glsdk/freeglut/src/freeglut_joystick.c|1597|error: ‘F_OK’ undeclared (first use in this function)|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
||=== Build: Debug in glload (compiler: GNU GCC Compiler) ===|
||=== Build: Debug in glimg (compiler: GNU GCC Compiler) ===|
||=== Build: Debug in freeglut (compiler: GNU GCC Compiler) ===|
I am currently running Ubuntu 14.04.
Help me solve this problem.
I finally got this to work, what I did was use the gmake platform instead, then by going to the *.make file generated I added -lx11 at the end of the line that begins with LIBS for both the debug and release options. Finally just run make config=debug and make config=release to get the executable files. Also, if you have multiple *.make files add -lX11 to all of them.