SDL 2.0 with Code::Blocks - opengl

Ever since I picked up SDL (which was not too long ago), I have used Code::Blocks with MinGW to develop... on Windows. Setting it up for SDL 1.2 was easy and quick.
Now I want to start with OpenGL 3.2, and since I already know SDL, I thought using it for OpenGL would be logical. So I downloaded SDL 2.0, which supports OpenGL 3.x, and tried to build the libraries.
I tried to make install with Cygwin, but it did not configure because I am on Windows. To get the .lib and .dll files, I followed the VisualC instructions and was able to generate them.
But I was pretty sure I wouldn't be able to use the *.lib files with MinGW. I couldn't.
So I tried to use reimp to convert the *.lib files to *.a. It did not work, all libraries were found to be "corrupt". Even glew32.lib which I downloaded and did not build myself. I am quite lost.
Can I even get it to work with MinGW, or do I have to switch to VisualStudio?
(I don't even know if VC++ 2010 Express Edition will be usable. The only reason I was able to build the VisualC libraries is because I used the Visual Studio Pro Trial. VC++ 2010 was not letting me do so earlier.)
Update:
I used MSYS to build the *.a and *.dll.a for both SDL 2.0 and GLEW. My project was linked properly and built without any problems. But, I am unable to run it.
I get the error "The application was unable to start correctly (0xc00007b)".
I know this problem is due to incorrect *.dll files. I have linked all the *.dll.a files I built, and I don't know why this problem is occurring.
What am I doing wrong?
(Here is the pastebin of the test program I wrote, but I doubt that the present problem is with the code.)
Update v2:
I solved it. I just put the *.dll files into the System32 folder, as well as the SysWOW64 folder.
Then, I just had to debug my code. Currently, you can't simply call SDL_Init(SDL_INIT_EVERYTHING) because there is no haptic support.
Now that I've got my stuff working, I'll get to developing. Thanks for your help.

You might want to try installing MSYS, which will provide you with a bash shell and the utilities for building a library on Windows.

Related

Building GSL (GNU Scientific Library) in Windows for use with VS2015

I am trying to build GSL as a library(DLL,lib) to use with my application. I have tested both GSL ports(gladman) to VS and CMake route and I do not want to go that path due to various reasons.
Currently I am using nuget version and I am not too happy about it as some functions are missing. I want to build it myself to be absolutely sure about what I am getting. The objective is to build four set of dll and libs---win32, win32d, win64 and win64d.
I know that from a MinGW library I can build lib file(for VS2015) and thereafter dll using Microsoft LIB tool if I have DEF file available.
My open source experience is very limited. Till now I have successfully built gsl for MinGW using ./config, make, make install. But I am not finding any DEF file generated and I do not know how to utilize this build to generate required DEF and dll to be used with Microsoft Visual Studio 2015.
Thank you
Building and linking has always been a pain for me as well. For mac, I use Homebrew, which downloads frameworks and libraries through a simple one-line-command in the terminal. I would then simply add the library into my program by adding the directory of the libs necessary. In XCode, there was an "add framework/library"-button where I added the directories, but I'm sure there's an analogue in VS.
However, you seem to be using Windows (so Homebrew will not work). I searched the web for Windows versions of Homebrew, and it seems that Scoop is pretty similar. You might want to check that out.
Hope this helped, despite me using different tools :)

Building log4cplus for Windows x64

I am supposed to build existing Windows 32bit project for Windows 64bit. (and probably linux 64bit too).
The project uses log4cplus library. That one only contains 32bit .lib files at the moment and is shining example of why I hate using libraries in C++ - there's just a bunch of source files and linux bash scripts. The INSTALL help file is entirely about the configure bash script which doesn't work on Windows. The configure probably just passes some arguments to GCC, but I don't known which ones.
I downloaded MinGW in hope I'll be able to use mingw32-make on the project and it will work, but no such thing happened.
So does anyone have any experience making those Linux projects on Windows? This is not the first time I tackle this problem - my third most viewed question is about broken Boost build. Judging from the view count, I'm not the only one who has problems building Linux project on widnows.
log4cplus maintainer here.
The master branch of log4cplug GIT repository is C++11 only. Because of this, it requires Visual Studio 2015 and thus the msvc14 directory is there.
Branch 1.2.x and its releases come with Visual Studio project files for version 2010. However, you might be able to build it using CMake for even older Visual Studio.
However, both of them, in any configuration, should have no problem building for AMD64 platform.
I also suggest that you read the README.md file. It documents many things, some of which might be useful to you, too.

C++, VS2010: Avoid downloading MS redistrubutable package. Link statically?

Can VS2010 link EVERYTHING into exe file that is needed? Or should i put MS VS2010 files into installation package? I don't want user to think about downloading and installing something.
Having tried to use static linkage for this reason in a large MFC project, using VS2010, I find that I still need to run the VS2010 SP1 redist package. The software works to a large extent without it, but users see a fair number of additional random bugs that seem to miraculously disappear once the redist is installed. I'm guessing it updates other windows components that the run-times are dependant on, but it is only a guess. My advice is to include it with your installation.

how to compile c++ files with cygwin on windows 7

I have installed cygwin. But when I try to compile a c++ file it gives the following error:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/cc1plus.exe: error while loading shared libraries: cygmpfr-1.dll: cannot open shared object file: No such file or directory
I checked in the lib folder there is no library with the name cygmpfr-1.dll. So is it that I have to put that dll in the lib folder. I have tried to search for the dll but could not find this dll so that i can download. I am just a beginner in C++. I have tried to setup cygwin support in netbeans as well, but there also if I try to run the sample files given, it throws the above error.
Can anybody give me a clue?
You need to install the gcc4-g++ package via http://cygwin.com/setup.exe
You only have gcc4 installed.
This will also install your missing dependencies.
If you're a beginner in C/C++, and you're running Windows, then why not take the simple route and get Visual-C++ Express, a free IDE from Microsoft for Windows.
It provides a GUI IDE (Integrated Development Environment), but if you prefer a text editor and command-line tools (compilers, debuggers, etc) those are available to you also, if you install Visual-C++ Express.
There are also tutorials and lessons to get you started.
On the other hand, if you really wanna focus on C++ on Linux, then you should probably uninstall Windows 7 right now.
I have had similar problems and I am no beginner. Try using the cygwin installer, and searching it for all versions of gmp. There generally are 32bit and 64 bit versions. Check everything you see and update your installation. Hope this helps. Some of these dll's you can find on the internet, but not the one you are looking for.

How to install MinGW correctly on Windows

I have recently started learning C++, but I require a compiler. I have tried the one packaged with Code::Blocks, but I have been told it is out of date.
I have tried reading the instructions on the website, but I simply don't know which files to download and un-zip. Is there a list of files to download? (latest version) and a folder structure I need?
I was the person that pointed you at the more up-to-date version at Twilight Dragon. The file you want there is http://sourceforge.net/projects/tdm-gcc/files/TDM-MinGW%20Installer/1.908.0/tdm-mingw-1.908.0-4.4.1-2.exe/download which is a Windows binary installer - you just run it. Note that you don't actually need to do this - the version that comes with Code::Blocks will work OK for someone starting to learn C++.
I recommend using a pre-packaged MinGW that includes some common APIs like Boost, SDL etc: http://nuwen.net/mingw.html
If I remember correctly, the only thing you must do to get it working is to modify Windows's PATH environment variable.
edit: OpenAL is not included in this package.
Here are some instructions to have a MinGW setup that I used to build Octave modules.
I have switched to using the build environment for msysgit. Just download the netinstall file and it will setup GCC, Make, etc. along with Git.