Author Topic: Why I got Error - "No such file or directory"?  (Read 27722 times)

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Why I got Error - "No such file or directory"?
« on: August 28, 2014, 01:17:06 pm »
I am trying to configure project according this tutorial:
http://blog.refu.co/?p=663

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:

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) ===|
 Files\AMD||No such file or directory|
 Files\AMD||No such file or directory|
 PROJECTS\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 form?

Code::Blocks v13.12 running on Windows XP

Edit:
Code
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
« Last Edit: August 28, 2014, 03:14:04 pm by wever »

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Why I got Error - "No such file or directory"?
« Reply #1 on: August 28, 2014, 05:08:15 pm »
Because these paths have spaces, so the compiler divides them into separate options.
Try putting these paths in quotation marks in project options.
Also, PROGRA~1 may be used instead of Program Files.
In general, avoid using paths with spaces.

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why I got Error - "No such file or directory"?
« Reply #2 on: August 28, 2014, 08:55:16 pm »
No, quotes did not help, at any form.
This is nothing to do with spaces.
This is to do with real file name as seen by MS-DOS (8 characters for file name and 3 characters for extenssion) or command.com interpreter.

Solution:
this is for case that somebody will find this post searching net
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.

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
why file is not found?
« Reply #3 on: August 28, 2014, 11:23:27 pm »
I have linked dll library:
W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
but when I try to build I got error:
Code
||=== Build: Debug in Gaussian_with_OpenCL (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lrefu.dll|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

The file really exists:
Code
W:\___NEW~1\GAUSSI~1\GAUSSI~2>dir

28.08.2014  20:41    <DIR>          .
28.08.2014  20:41    <DIR>          ..
28.08.2014  12:55    <DIR>          bin
28.08.2014  16:12             1 707 Gaussian_with_OpenCL.cbp
28.08.2014  16:56               224 Gaussian_with_OpenCL.depend
28.08.2014  20:25               139 Gaussian_with_OpenCL.layout
24.11.2013  20:14               117 main.cpp
28.08.2014  12:55    <DIR>          obj
31.08.2012  14:47           216 347 refu.dll

Why the compiler does not see complete path?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: why file is not found?
« Reply #4 on: August 28, 2014, 11:30:10 pm »
You've not posted the full build so we can hardly help you!

See here for details: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Insisting on using 8.3 file names will cause problems in the long run for sure...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: why file is not found?
« Reply #5 on: August 28, 2014, 11:55:42 pm »
CodeBlocks_13.12\MinGW\bin>gcc --version
gcc (tdm-1) 4.7.1

I have use the 8.3 format because the compiler gives me errors otherwise. This is just the version which is in the Code::Blocks installation file.

Full Build log:

mingw32-g++.exe -Wall -fexceptions -g -I"W:\___NEW PROJECTS\GaussianBlur\OPENCL tests\opencl\cl" -IC:\PROGRA~1\AMDAPP~1\linclude\CL -c W:\___NEW_PROJECTS\GaussianBlur\Gaussian_with_OpenCL\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\PROGRA~1\AMDAPP~1\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:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lrefu.dll
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 0 warning(s) (0 minute(s), 1 second(s))
 
« Last Edit: August 29, 2014, 12:02:35 am by wever »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: why file is not found?
« Reply #6 on: August 29, 2014, 12:28:23 am »
What is this "C:\Program Files\AMD APP\lib\x86\OpenCL.lib"?

Why are you specifying full paths to the libraries?

It is better to just add libname.ext without the lib prefix and without the extension.
The path should be entered separately in the search path -> linker in your project.

Try to use relative paths as much as possible!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Why I got Error - "No such file or directory"?
« Reply #7 on: August 29, 2014, 12:58:03 am »
Please do not start a new topic for the same problem !

Especially if the second issue is cause dby the "solution" of the first one.

As you can see, I merged both topics.

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why I got Error - "No such file or directory"?
« Reply #8 on: August 29, 2014, 11:32:58 am »
ObFuscate:
I did not decided to install the path as AMD did.

I did not saved yesterdays project. Maybe the error disappeared, when I corrected it today. Im not sure. But new error here now, but this one is different.


Code
mingw32-g++.exe -Wall -fexceptions -g  -c W:\___NEW_PROJECTS\GaussianBlur\GaussianBlur\main.cpp -o obj\Debug\main.o
W:\___NEW_PROJECTS\GaussianBlur\GaussianBlur\main.cpp:2:19: fatal error: CL/cl.h: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I try include:
Code
#include <CL/cl.h>
and the path in configuration is:
C:\PROGRA~1\AMDAPP~1\include
in Search directory - compiler

jens:
thanks for correction
« Last Edit: August 29, 2014, 11:34:38 am by wever »

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why I got Error - "No such file or directory"?
« Reply #9 on: August 29, 2014, 02:03:12 pm »
Right now I am having this error:
Code
mingw32-g++.exe -LC:\PROGRA~1\AMDAPP~1\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:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lrefu.dll
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))

But I cannot find out why it says that it cannot find the path with refu.dll because when I copy the path: W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll and try to open, so Windows can find the file... What am I doing wrong?

Edit:
I see the path "Program Files":
-lOpenCL  "C:\Program Files\AMD APP\lib\x86\OpenCL.lib"
but why it is there? It should not to be like that when I configureted the project to 8.3 file names

What is this "C:\Program Files\AMD APP\lib\x86\OpenCL.lib"?

Why are you specifying full paths to the libraries?


I don't. I have specified:
"C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib"
so why compiler gets different file name?
« Last Edit: August 29, 2014, 02:07:16 pm by wever »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Why I got Error - "No such file or directory"?
« Reply #10 on: August 29, 2014, 06:16:07 pm »
Firs of all: this is a problem with spaces... You are now simply using the old ( i dont know the right name) short ms names. You woul it heave more easy if you copy your files in a path without spaces.... But if you choose the hard way good luck...

To your library problem: in the project build options you have to select your build target on the left. Then go to the linker tab. On the left side called "libraries" add only the name of the library, without extension an a path.
On the tab search directories add the path to the directory where the library is located, without the library name.

Greetings.

Ps. The only log we need is the "full build log" not the build mesages...

Offline Vuki

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Why I got Error - "No such file or directory"?
« Reply #11 on: August 29, 2014, 06:48:54 pm »
Right now I am having this error:
Code
mingw32-g++.exe -LC:\PROGRA~1\AMDAPP~1\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:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lrefu.dll
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))

But I cannot find out why it says that it cannot find the path with refu.dll because when I copy the path: W:\___NEW~1\GAUSSI~1\GAUSSI~2\refu.dll and try to open, so Windows can find the file... What am I doing wrong?

"-lrefu.dll" is wrong. Try either "refu.dll" or "-lrefu".

Edit:
I see the path "Program Files":
-lOpenCL  "C:\Program Files\AMD APP\lib\x86\OpenCL.lib"
but why it is there? It should not to be like that when I configureted the project to 8.3 file names

You have left a full path somewhere in your project. Open the cbp file in text editor and you'll find it.

I don't. I have specified:
"C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib"

You have also specified "-lopencl". This is redundant, you are trying to link to opencl.lib twice.

EDIT:
I've just checked that my compiler version 4.8.1 handles paths with spaces without problems (I'm on Win8 though). Try upgrading your compiler - google for TDM MinGW.
« Last Edit: August 29, 2014, 06:58:13 pm by Vuki »

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Re: Why I got Error - "No such file or directory"?
« Reply #12 on: August 30, 2014, 01:05:30 am »
Ok, I have edited the file. When I write just refu as the link so this is still not working

mingw32-g++.exe -Wall -fexceptions -g -IC:\PROGRA~1\AMDAPP~1\include -IC:\PROGRA~1\AMDAPP~1\include -c W:\___NEW_PROJECTS\GaussianBlur\Gaussian_with_OpenCL\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\PROGRA~1\AMDAPP~1\lib\x86\ -o bin\Debug\Gaussian_with_OpenCL.exe obj\Debug\main.o   C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib -lrefu.dll C:\PROGRA~1\AMDAPP~1\lib\x86\OpenCL.lib -lrefu
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lrefu.dll
p:/programy/programování/codeblocks_32bit/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lrefu

What's that:
../lib/gcc/mingw32/4.7.1/../../../../
this is not path which C::B installed. My path is:
P:\PROGRAMY\programování\CodeBlocks_32bit\MinGW\bin
How got it there?

I'll update the compiler tomorrow

This is my project file:
http://paste.ofcode.org/37ZnaeyJ87ttY5zAFbWYsHj

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Why I got Error - "No such file or directory"?
« Reply #13 on: August 30, 2014, 01:32:13 am »
What's that:
../lib/gcc/mingw32/4.7.1/../../../../
Internal path to the linker. It is not interesting. The error message after it is the one that you should look at!

I'll update the compiler tomorrow
Probably it won't help... the problem is not caused by your compiler...

The best thing you can try is to learn how to compile your project from the command line...
Search for tutorials, read the gcc's manual about -I, -l and -L...
Without clear understanding what these options do you'll always suffer!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Why I got Error - "No such file or directory"?
« Reply #14 on: August 30, 2014, 09:01:22 am »
Add the search paths for linker and compiler in the appropriate tabs, use the button with the "..." to add them.
Try it without 8.3-notation.
Add the libs just once (either per target or per project) in the library tab.
Add them without ending, without a probable prefix ("lib") and without -l or whatever.
Maybe you should create a new empty project from scratch to get  rid of incorrect stuff.

Offline wever

  • Multiple posting newcomer
  • *
  • Posts: 49
Solved
« Reply #15 on: August 30, 2014, 10:37:11 am »
Add the search paths for linker and compiler in the appropriate tabs, use the button with the "..." to add them.
Try it without 8.3-notation.
Add the libs just once (either per target or per project) in the library tab.

All these steps I already did and they generated errors as you can see in the first post. I see no sense for this, I tried it many times so why should I again. The errors clearly said that the path "files/AMD" does not exist. When I see something what looks like apple so it's apple.

I don't understand why the -I directory is repeated twice. Maybe they are not the same meaning when first is preceded by -g


In the project file there is one mention of the path for Debug and one for Release.

Also I don't understand why it says cannot find -lrefu.dll but here we are:

In the project file Build -> Debug - this path is OK.
But Build -> Release
there is
<Add library="refu.dll" />

Now corrected. Errors 0.

I have no idea why it was changed in the file, why the rows were not same value. Thanks for assistance.
« Last Edit: August 30, 2014, 11:33:32 am by wever »