CODE::BLOCKS - why path is incorrect? - c++

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.

Related

How to add cryptopp to project in OMNeT++

First, I built the cryptlib (of cryptopp) in Visual Studio Code 2022. And tried a sample c++ program (using files from the library) and it worked fine.
Then, I included the library cryptlib.lib in my OMNeT++ project.
I also included the cryptopp folder for the .cpp and .h files of the library.
But when I build the omnet++ project, I get this error:
03:05:22 **** Incremental Build of configuration debug for project crypto_final ****
make MODE=debug all
cd src && /usr/bin/make
make1: Entering directory '/d/omnetpp-5.7/samples/crypto_final/src'
Server.cc
Creating executable: ../out/clang-debug/src/crypto_final_dbg.exe
lld-link: error: could not open 'liblibcpmt.a': No such file or directory
lld-link: error: could not open 'libLIBCMT.a': No such file or directory
lld-link: error: could not open 'libOLDNAMES.a': No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:99: ../out/clang-debug/src/crypto_final_dbg.exe] Error 1
make[1]: Leaving directory '/d/omnetpp-5.7/samples/crypto_final/src'
make: *** [Makefile:2: all] Error 2
"make MODE=debug all" terminated with exit code 2. Build might be incomplete.
03:05:25 Build Failed. 2 errors, 0 warnings. (took 3s.352ms)
I don't even know what are these libraries or how to get them built.
Can anyone help, please?
Edit #1: btw, when I change the Target type from "Executable" to "Static library (.lib or .a) in makemake options, the project builds normally but does not run properly (has some bugs and no effects can appear on the simulation)
OMNeT++ project uses Makefile, therefore to add an external library or class one should modify makefrag.
You should go to Project | Properties | OMNeT++ | Makemake | select root or src of your project | Options, then Custom | Makefrag and write the following lines:
EXTRA_OBJS += -L/d/foo/lib -llibcpmt -lLIBCMT -lOLDNAMES
CFLAGS += -I/d/foo/include
where /d/foo/lib is an example of the directory which contains your cryptlib static files (e.g. liblibcpmt.a, libLIBCMT.a, ... ), and /d/foo/include - the directory that contains header files of cryptlib.
Omnet++ useses MinGW as the runtime system and the C++ compiler's ABI is incompatible with the MS ABI (i.e. C++ code generated by Visual Studio C++ compiler is incompatible with the code generted by gcc or clang).
You MUST compile your crypto library also with the clang compiler coming with OMNeT++. Visual Studio compiler will NOT work.
Or... OpenSSL libraries and headers are already available in the Windows distro, so you can pt to use that.

Compile Error on CodeBlocks with C++ obj/Release/MyApplication.o: no such file or directory under Ubuntu 20.04

I'm new with C++ and also with CodeBlocks; what I'm trying to do is a simple frame with wxwidgets which holds a button inside and test some events.
The compiler outputs the following error:
**=== Build: Release in Prueba (compiler: GNU GCC Compiler)===
error: obj/Release/PruebaApp.o: No such file or directory
error: obj/Release/PruebaMain.o: No such file or directory
error: no input files
=== Build failed: 3 error(s), 0 warning(s) (0 minute(s)), second(s) ===**
Help, please!
Thank you very much.

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.

gSoap error : xlocale.h No such file or directory

I am trying to create C++ soap webservice client in Windows 7. I am using gSoap and I followed gSoap tutorial.
first and second commands worked but
c++ -o main main.cpp soapC.cpp soapcalcProxy.cpp stdsoap2.cpp
command did not work.
error is
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\user\Desktop\soap>C:\MinGW\bin\mingw32-g++.exe -o main main.cpp soapC.cpp soapcalcProxy.cpp stdsoap2.cpp
In file included from soapStub.h:22:0,
from soapH.h:16,
from calc.nsmap:2,
from main.cpp:16:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from soapStub.h:22:0,
from soapH.h:16,
from soapC.cpp:19:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from soapStub.h:22:0,
from soapH.h:16,
from soapcalcProxy.h:16,
from soapcalcProxy.cpp:14:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
In file included from stdsoap2.cpp:60:0:
stdsoap2.h:651:23: fatal error: xlocale.h: No such file or directory
compilation terminated.
How can I solve it ?
I am using Windows 7 64 bit and mingw.
Thanks.
I had the same problem, I solved it by adding the -DWITH_NO_C_LOCALE option when compiling.
Source: https://sourceforge.net/p/gsoap2/bugs/1098/

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.