PlaySound() In C++ Doesn't Work - c++

I've been trying to figure this out, and I just can't seem to.
When you include window.h at the top, there is supposed to be a PlaySound() function inside of it.
I added window.h but I keep on getting a "PlaySound was not declared in this scope" error.
I tried going into the project's build options and adding "-lwinmm" into the linker settings, but it still doesn't work.
I'm using Code::Blocks.
Anyone have a solution?

You need to #include both windows.h and mmsystem.h, in that order. This is noted in the community section of the documentation.

I assume you are coding on windows and you actually wanted the interface file called "Windows.h". Also make sure you are using the correct namespace, I'm not a windows programmer, but that's a start. I also don't know haw you are loading the file or wether you are using the win32 or .net frameworks. But then from the sounds of it you might not either.
If you're trying to use .net you can start here
http://msdn.microsoft.com/en-us/library/system.media.soundplayer
win 32 start here
http://msdn.microsoft.com/en-us/library/ff818516(v=vs.85).aspx
ah here it is winCE audio API
http://msdn.microsoft.com/en-us/library/aa909766.aspx

Related

How do I get CodeLite to find headers for FLTK or wxWidgets (MacOSX)?

My apologies, I realize this question may be covered in other questions/articles, but I am not very knowledgeable about "under-the-hood" computer workings, and I have only gotten frustrated so far by trying to look up existing answers.
I'm just trying to teach myself some programming, and I'd like to tinker with a GUI. I'm trying to use CodeLite, and trying to make use of either FLTK 1.3.5 or wxWidgets 3.1.3. I get the sense that I need to do something with
Project Settings->Compiler->Include Paths, and/or Project Settings->Linker->Libraries Search Path (and ->Libraries), or possibly Environment->environment variables.
The problem is I don't know exactly what to put, as when I open the folder for either wxW or FLTK there is a sea of files and I don't know what exactly I'm trying to get CodeLite to find. I'm also used to double-clicking icons, and when it says to specify a path I don't know if I'm clear on the syntax for that.
Can someone let me know what to do to simply use
#include <wx/wx.h> or #include <Fl/fl.h>
and not run into any problems?
CodeLite 12.0.3, MacOSX 10.14.2, clang 1001.0.46.4

Arduino Tiny GPS Library

So the problem is TinyGPS++.h keeps saying "no files or Directory". I have added the library manually, did not work. I used Platformio to add the library using there manager, Both of them did not work. TinyGPS.h works but not TinyGPS++ witch is the one I need for my project. Any idea what's going on?
Follow the tutorial Installing an Arduino Library - learn.sparkfun.com
So I don't know what fixed it. I came back to the project today and it was not reded out, and the library is magically working. The only thing I did was play video games, and update windows. Eh Go figure. Thanks for the advice.

Unity3d iOS c++ native library plugin. How to?

I'm using this c++ particle physics library in my game. So far I have it working in unity on android and windows.
I'm now looking into getting it working on iOS and it seems like quite a daunting task.
The library is a superset of Box2D so it is quite a large complex library.
Here is my idea for tackling this, I'm hoping someone with some experience can say if they think this might work, or if not suggest a better way of doing it.
My idea is to..
Use Unitys 'Automated plugin integration' where you add your .cpp and .h source files to the Assets\Plugins\iOS folder and it sym links them in the xcode project (whatever that means)
The problem here is that subfolders are not supported so I would have to flatten the directory structure of the Box2D project and put everything in one folder. My idea is to do this using a python script that will change all the include statements in the source code so for example..
#include <Box2D/Common/b2Settings.h>
would be changed to..
#include <b2Settings.h>
Is there a reason this would not work?
Ok, So that crazy idea actually worked! The performance was terrible on an iphone 4 but absolutely flawless on a iphone 5. The only other issue I had was I had to turn
#include <Box2D/Common/b2Settings.h>
into
#include "b2Settings.h"
Xcode didnt like the pointy brackets.
Also this failed to build on the simulator but worked on an actual device

QT + CImg will not build on OSX 10.9

I'm taking over a project where I need to work with QT Creator and CImg, however it won't build on my machine.
/Users/vikkosmi/Qt/5.2.0/clang_64/lib/QtCore.framework/Headers/qvariant.h:132: error: expected '}'
Bool = QMetaType::Bool,
^
This error, and a dozen similar ones, keeps appearing when I build. Its coming from the Qt Core.
Are there things that need to be rewritten when you move from a windows platform to osx using cimg? As far as I know the code should be portable..
I tried to reinstall libraries, install XQuarts, add library and include paths to the project file, but still the same problem :( Thanks in advance for your help!
What are you building? If you're building Qt, then you have some local modifications that broke it - start with fresh sources.
If you're building some code that uses Qt, then the problem is in that code, not in Qt. The smell of this issue is that something has defined a Bool macro that interferes with QVariant's code.
The file where this happens is not qvariant.h. It is some .cpp file of yours - look at the error messages, they will include something like "while compiling yourfile.cpp". In that file, you need to put #include <QVariant> as the very first line. This should fix the problem temporarily.
You should search for Bool in your code and fix the global namespace pollution. Your code is broken, no doubt about it I think.
The X11 library (used by default by CImg) defines Bool.
As you are working with Qt, you probably don't want to use display capabilities of CImg, so I suggest you deactivate it by defining the macro cimg_display=0when compiling.
CImg will not try to include the X11 headers, and it may solve your problem.

Using existing C/C++ code in Metro App

i want to use existing C/C++ Code in a Metro App. I've made a "Blank App (XAML)", include my header files etc. Everything is compiling fine, but the linker doens't find my functions and global variables that i need to initalize my stuff. I've ported my code to many platforms like iOS, Android and other without any problem linker problems.
I think the "Blank App (XAML)" project is using managed C++ is this correct? is there any trick to use unmanaged C/C++ code in managed C++? Any other idea?
Thank you in advance!
Best Mario