SFML unable to open file - c++

I used SFML to create ARKANOID.
If I run in debug mode, it will run normally.
But when I run in Release mode, it can't read the image file.
In the Command window, the output is as follows:
Failed to load image " ?? 
"? ". Reason: Unable to open file
Failed to load image "es/ball.png  ". Reason: Unable to open file
Failed to load image "es/ball.png
"? ". Reason: Unable to open file
Failed to load image "es/ball.png 
"? ". Reason: Unable to open file
I've tried the absolute path and I've tried the relative path.
And i also tired loadFromFile("images/ball");
please help me

You need to put the PNG file in the directory where main.cpp is located. You can put it in both the debug directory and the release directory. Also note the file extension in the directory (.png or .jpg) and edit the code.

Try pasting the image where the execution folder or where the compiler is example in codeblocks if you have MinGW then paste it "C:\Program Files (x86)\CodeBlocks\MinGW\bin" and it will work

Related

gedit to create sql file

I am using cloudera VM 5x.
In the HDFS terminal, I am using the below command to create a sql file.
gedit /user/cloudera/sample.sql
It is in edit mode, when I am saving, it is throwing an error "Could not find the file /user/cloudera/sample.sql."
What's wrong with it? Even I tried to provide the full path
gedit hdfs://quickstart.cloudera:8020/user/cloudera/sample.sql
This is also returning an error saying "Could not open the file hdfs://quickstart.cloude…ser/cloudera/sample.sql." along with "gedit cannot handle hdfs: locations."
What is supposed to be the command here?
Please help.
I figured out it.
gedit /user/cloudera/sample.sql
This will not work since gedit saves the file into local file system and /user/cloudera is HDFS path.

Failing to load a png image in SDL2

I am trying to load PNG image, but it always ends in an error. I was first trying to use SDL's SDL_LoadBMP, but since that dind't work, I downloaded SDL2_image.h, did all the setup, but it still isn't working. The image is in the same directory as the cpp file. When I run my program, it runs, but prints error. Here is the function to load the image:
void loadImage()
{
image = IMG_Load("Untitled.png");
if (image == NULL)
std::cout << "error: " << SDL_GetError();
}
The error message from SDL_GetError is Failed loading libpng16-16.dll: The specified module could not be found. I tried passing the full path, but it gives an error and I don't know how to get around that problem since I am a beginner. Thanks.
Edit: After reading through the article linked in the answer to the tagged-duplicate question and making some changes(particularly installing the missing dll file and putting it in the same directory as the main cpp flie), I am getting this error message in a pop-up window: The procedure entry point inflateValidate could not be located in the dynamic link library, and the path to libpng16-16.dll is given after that.

Fatal error: cannot open file '-c= ' : No such file or directory (SPP, phantompeakqualtools)

I am trying to run phantompeakqualtools in the terminal, I am using a WSL in Visual Studio Code.
I have followed all the steps and installed dependencies to use this program as listed here: https://code.google.com/archive/p/phantompeakqualtools/ and here: https://github.com/kundajelab/phantompeakqualtools
However when I try to execute, it says no such file or directory while clearly the file is there.
The file is in the correct format, a tagAlign.gz file. But somehow it can't find it. I also tried to run it as sudo but that didn't work either.

Tizen Studio Debugger Message: Cannot launch application with GDBClient

I am working on a Hybrid App (Web UI with Native Service) of API version 4.0 for my Gear S3 Frontier. After successful compilation of the App, In order to track the cause of application crash, when I launch it on emulator W-4.0-circle-x86-preview in debug mode, it gives an error message.
Error Message:
Cannot launch application with GDBClient.
Error in final launch sequence
Failed to execute MI command:
source G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand
Error message from debugger back end:
G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand:5: Error in sourced command file:\nG:Computer ScienceApp DevelopmentMyAppGalaxyWatchAppMyAppNative ServiceDebugMyAppservice: No such file or directory.
G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\.gdbcommand:5: Error in sourced command file:\nG:Computer ScienceApp DevelopmentMyAppGalaxyWatchAppMyAppNative ServiceDebugMyAppservice: No such file or directory.
GDBCommand File Contents:
set sysroot C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core
set debug-file-directory C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core\usr\lib\debug
set solib-search-path G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug
dir C:\Tizen\TizenStudio\tizen-studio\platforms\tizen-4.0\wearable\rootstraps\wearable-4.0-emulator.core\usr\src\debug
file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice"
sharedlibrary
During the web search I found some of the GDBClient errors but couldn't find the solution to this one.
I've also tried setting the path of GDB Debugger to i386-linux-gnueabi-gdb-7.8 and GDB Command File to the absolute path of .gdbcommand which should be run.
It seems like the problem lies with this line:
file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice"
Try to remove spaces from the directory name. Change Computer Science to something like Computer_Science and App_Development to App_Development. Then right-click on your project and go to Debug As -> Debug Configurations..., then delete the active debug configuration and again create new one.
You may also try by removing the whole line file "G:\Computer Science\App Development\MyApp\GalaxyWatchApp\MyApp\Native Service\Debug\MyAppservice" from the .gdbcommand file manually and check if it fixes the issue.

loadFromFile() not loading in sfml

I'm using sfml 2.1 in xcode4. ballSpriteSheet.png is in the project folder. It loads using a full file path. Why won't the file load as written? If not possible as written, can you at least set a relative path?
if(!tBall.loadFromFile("ballSpriteSheet.png"))
std::cout << "ERROR: Could not load ball sprite sheet!" << std::endl;
In output...
Failed to load image "ballSpriteSheet.png". Reason : Unable to open file
ERROR: Could not load ball sprite sheet!
Thanks in advance!
The error reffer to the image that cannot be found. Please check the image to be in the project or to be next to your '.exe' and to be named correctly.