SFML: Unable to run code because of soundbuffer error - visual-studio-code

I came across a problem that wouldn't let me play sounds on SFML. Whenever I call the sf::SoundBuffer buffer; object, the code would break and spit out an error.
I either think its a problem inside the makefile. Other than that, I'm completely lost in what to do
Sample of makefile:
all: compile link
compile:
g++ -I src/include -c main.cpp
link:
g++ main.o -o Sorter -L src/lib -l sfml-audio -l sfml-graphics -l sfml-window -l sfml-system
Picture of the error

Related

Missing 'libexpat-1_.dll' error for executable made with pp

I made exe file with pp using Strawberry Perl, but when I run it on another machine, I get following error:
The program can't start because libexpat-1__.dll is missing from your computer. Try reinstalling the program to fix this problem.
I make the executable with this command:
pp -M FindBin -M DateTime -M DateTime::Format::JSON::MicrosoftDateFormat -M DateTime::Format::DateParse -M REST::Client -M JSON::XS -M Spreadsheet::ParseExcel -M Spreadsheet::ParseXLSX -M Log::Log4perl::Tiny -o test.exe test.pl
I tried using -a "c:\strawberry\c\bin\libexpat-1_.dll" (didn't help) and -l "c:\strawberry\c\bin\libexpat-1_.dll" ("Can't find shared library.." error).
How can I resolve this issue?
I had a typo in DLL name. Using -l option resolved issue. Specifying modules in the command wasn't necessary, as pp scans script for the used modules, and includes them automatically. Built it with:
pp -l "libexpat-1__.dll" -o test.exe test.pl

Eclipse Makefile: Make Variables are skipped

I have a project with a Makefile in it, on Unix console it works fine, compiles, builds and I can run the binary at the end.
I imported the project into Eclipse workspace and somehow Makefile module of Eclipse cannot build the project now. It gives the following error:
g++: error: /src/main: No such file or directory
Whereas there should have been
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main
which uses two make variables. I already put them before this line and define them as :
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
Same Makefile is fine with console, but not with Eclipse, which is weird.
Any thoughts?
Here is where I put my export lines:
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main -g -o src/obstacleDetection.o -c src/obstacleDetection.cpp
cd libs && cp $(CMS_HOME)/src/main/.libs/libactivemq-cpp.so.18.0.4 . && ln -sf libactivemq-cpp.so.18.0.4 libactivemq-cpp.so.18
g++ -L $(CMS_HOME)/src/main/.libs/ -g -o bin/obstacleDetection src/obstacleDetection.o src-gen/Point.pb.cc src-gen/Point.pb.h -lactivemq-cpp -lssl -lprotobuf -pthread
#echo "Success. Run the executable from the binary directory with: LD_LIBRARY_PATH=../libs/ ./obstacleDetection"
This is not right:
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
g++ $(APR_INCLUDE) -I $(CMS_HOME)/src/main ...
All lines in the recipe (that is, lines that are indented with a TAB in a target context like this) are passed to the shell. These are not make variable assignments. There are two things wrong with that:
First, each logical line in the recipe is passed to a new shell. That means any changes to the process context (such as the environment or the working directory) are present only for the duration of that logical line; once the shell processing that line exits, all those changes are lost. So, these lines have no impact: they set an environment variable in the shell, then the shell exits and that setting is gone.
Second, the variable references you make in your compile line, such as $(APR_INCLUDE), are make variable references, not environment variable references. So even if those environment variable assignments still had effect, they would not be used because you're not referring to environment variables here.
You want to create make variable assignments. That can only be done outside of a recipe. Also, you don't need to export them because only make needs to see them (make will expand them before invoking the shell). So, your makefile should look like this:
APR_INCLUDE = /usr/include/apr-1
CMS_HOME = $(HOME)/Desktop/activemq-cpp-library-3.8.4
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main -g -o src/obstacleDetection.o -c src/obstacleDetection.cpp
cd libs && cp $(CMS_HOME)/src/main/.libs/libactivemq-cpp.so.18.0.4 . && ln -sf libactivemq-cpp.so.18.0.4 libactivemq-cpp.so.18
g++ -L $(CMS_HOME)/src/main/.libs/ -g -o bin/obstacleDetection src/obstacleDetection.o src-gen/Point.pb.cc src-gen/Point.pb.h -lactivemq-cpp -lssl -lprotobuf -pthread
#echo "Success. Run the executable from the binary directory with: LD_LIBRARY_PATH=../libs/ ./obstacleDetection"

aapt can't find 9Patch Images

I want to certificate an Android project just with cmd. Now Im stocked at the creation of the .apk file. aapt says he cant find the pictures with the .9. ending. If i rename this pictures and delete the .9. ending then everything works fine without the correct size of the pictures in the app.
ettings
I figured out that I have to "crunch" this pictures, like what he says at the page: Ant Build AAPT Crunch is stripping draw9 information from Library resource images but Im not sure how this works correctly.
I tried this command:
aapt crunch -v -S res -C bin/res
It works with my .9.png files but I still dont get it how I can run it, that it creates the .apk file. How can I use it in the following command ?
aapt package -v -f -A \assets -M \AndroidManifest -S \res -I \android.jar -F \Projectname.unsigned.apk \bin
Just this command gives me the following error:
activity_settings.xml:2: error: Error: No resource found that matches the given name (at 'sound' with value '#drawable/btn_sound_active_pressed')
This file is an .9.png file.
With eclipse everything runs fine.
So i figured it out: I have to "crunch" all picture in the res folder first:
aapt crunch -v -S \res -C \bin\res
And then I pointed as a source folder to the res dir and to the bin\res dir. Also added --no-chrunch --generate-dependencies
aapt package --no-crunch --generate-dependencies -v -f
-M \AndroidManifest.xml"
-S \bin\res
-S \res
-A \assets
-I \android.jar
-F \bin\APPNAME.unsigned.apk \bin
Now Its working perfectly. Also with the .9.png 9patch pictures.

unable to build binutils for my cross compiler

i am trying to build binutils 2.19.1 with mingw/msys using following commands:
export PREFIX=/usr/local/cross
export TARGET=i586-elf
cd /usr/src
mkdir build-binutils
cd /usr/src/build-binutils
../binutils-x.xx/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make all
make install
and im getting following errors:
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../binuti
ls-2.19.1/bfd -I. -D__USE_MINGW_FSEEK -I. -I../../binutils-2.19.1/bfd -I../..
/binutils-2.19.1/bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-proto
types -Wno-format -Werror -g -O2 -D__USE_MINGW_ACCESS -c -o archive.lo ../../bin
utils-2.19.1/bfd/archive.c
./libtool: line 2258: cygpath: command not found
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../binutils-2.19.1/bfd -I. -D__U
SE_MINGW_FSEEK -I. -I../../binutils-2.19.1/bfd -I../../binutils-2.19.1/bfd/../in
clude -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format -Werror -g -
O2 -D__USE_MINGW_ACCESS -c "" -o archive.o
gcc.exe: error: : No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
make[3]: *** [archive.lo] Error 1
make[3]: Leaving directory `/usr/src/build-binutils/bfd'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/src/build-binutils/bfd'
make[1]: *** [install-bfd] Error 2
make[1]: Leaving directory `/usr/src/build-binutils'
make: *** [install] Error 2
/x.sh: line 8: ../gcc-4.5.0/configure: No such file or directory
make: *** No rule to make target `all-gcc'. Stop.
make: *** No rule to make target `install-gcc'. Stop.
i am getting the same error even for the diff binutils version,i have tried binutils-2.19.1, 2.22.0, 2.23.1
so what can be the problem ??
also my mingw's gcc compiler version is 4.6.2
i've also tried the command
make CFLAGS="-Os -w"
bt still the same problem persists
I'm getting a similar error ("cygpath: command not found"), but with newer versions. FWICT there is a line within binutils that assumes that Cygwin is present, although I didn't see any notes in the build instructions saying that Cygwin was required (I might have missed it, though).
I suppose the correct approach would be to install Cygwin, but I'm not sure if that will interfere with Mingw in other ways. It looks like binutils is just trying to use cygpath to convert between O/S path naming conventions, so I got around this problem by creating a little dummy cygpath shell script:
#options described at http://cygwin-lite.sourceforge.net/html/cygpath.html
#echo "MISSING CYGPATH"
if [ "x$1" == "x-w" ]
then
echo $2 #just echo path name back as-is
else
read -p "MISSING CYGPATH. PARAMS WERE: 1=$1 2=$2 3=$3 4=$4 5=$5"
fi
I placed this on the PATH so binutils could find it, instead of getting an error during the build. This script just echoes the path name back as-is (for the path renaming scenario), since Windows seems to be able to understand Unix-style paths anyways these days (and I was running on Windows). For anything else, this script will pause and display the first few command line parameters, to provide some hints as to what further functionality is needed.
HTH someone get a little farther

thrift programming problem

hi
i just start programming with thrift api . i run a sample code but i dont know how to run thrift program. i just did following :
code;
{#!/usr/local/bin/thrift --gen cpp
namespace cpp Test
service Something {
i32 ping()
}
than run command
thrift --gen cpp your_thrift_file.thrift
it generate seven file in a folder name gen-cpp which are following:
Something.cpp
Something.h
Something_server.skeleton.cpp
your_thrift_file_constants.cpp
your_thrift_file_constants.h
your_thrift_file_types.cpp
your_thrift_file_types.h
now i compile them all together to get executable by following command
g++ -Wall -I/usr/local/include/thrift -c Something.cpp -o something.o
g++ -Wall -I/usr/local/include/thrift -c Something_server.cpp -o server.o
g++ -Wall -I/usr/local/include/thrift -c your_thrift_file_constants.cpp -o constants.o
g++ -Wall -I/usr/local/include/thrift -c your_thrift_file_types.cpp -o types.o
than i write a client code which is following
{ #include "Something.h" // As an example
#include <transport/TSocket.h>
#include <transport/TBufferTransports.h>
#include <protocol/TBinaryProtocol.h>
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
using namespace Test;
int main(int argc, char **argv) {
boost::shared_ptr<TSocket> socket(new TSocket("localhost", 9090));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
SomethingClient client(protocol);
transport->open();
client.ping();
transport->close();
return 0;
}
now than i compile it with command
g++ -Wall -I/usr/local/include/thrift -c something_client.cpp -o client.o
and than make the executable by following command
g++ -L/usr/local/lib -lthrift client.o Something.o constants.o types.o -o Something_client
But when i run it it shows following error
command: ./Somthing_client
result:Thrift: Fri May 20 10:49:17 2011 TSocket::open() connect() Connection refused
terminate called after throwing an instance of 'apache::thrift::transport::TTransportException'
what(): connect() failed: Connection refused
Aborted
now i don't understand what I'm doing wrong?
can anybody explain me thrift working ?
how to run this code properly ?
what is this code doing ?
Is your Thrift server running too? The client needs something to connect to. The error looks like there's no open socket on port 9090 (set in your code).