Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Sunday, April 17, 2011

Facepalm

 warning C4237: The export-keyword is not supported but is reserved for future use.
One question: Why did they implement it in the first place?

Sunday, March 13, 2011

Sometime I just hate C++

Sometimes I just hate C++.

Like now...
I made a class called "FileAgent", this class has the following method:
 std::string FileAgent::createTmpFile( std::string &content) 

This method creates a temporary file with a random name.
It returns the name of the temporary file and puts a newly created object "FileHandle" in a list where all temporary files gets managed and deleted if they have surved they purpose.

Sounds great, doesn't it?...

I just wanted to test the function before going to sleep, but it turns out that SOMEHOW it is not possible to return an std::string from an DLL to an Executable.

I then tried to return the filename as a c string but that also didn't worked so well (the filename looked like shit).

I guess I have to redesign that somehow to make it work...Damnit...

Thursday, January 27, 2011

Finally got QT static linkage working! (How-to inside)

Yesterday I gave the current build of the leveleditor to a friend to test if the application runs correctly. He got an "Side-by-side configuration is incorrect" error when he wanted to start the editor.

After some investigation I found out that since VS2005 and Windows Vista you have to ship the Visual C++ Runtime library (Downloadlink see below) with your application to make them run properly.
(You'll notice the installation of the runtime files after you start nearly every game the first time in Valves Steam).

So you now have two choices...Either you ship your application with the runtime install files or you link the runtime library staticly to your application.Easy choice yeah...?

Well no. I was FORCED to find out that's it not that easy.

The tricky part is that every library you use in your application also has to be staticly linked with the runtime files.

So if you use foo.dll (DLL = Dynamic link library) and want to use it with your bar.exe but don't want the user to install the visual c++ runtime you'll have to compile foo.dll as foo.lib. To do that you have to open your DLL-project in Visual Studio and go to Project->Settings->Configurationsettings->Common. Set "Configurationtype" from "*.dll" to "*.lib" and choose "use MFC in a static library" at "Usage of MFC" after that go to "C\C++ -> Code generation" and change "Multithreaded Debug DLL" to "Multithreaded Debug" (Or "Multirthreaded DLL" to "Multithreaded" if you want to build a release).

If you've done that you do the same in your application project and then you are ready to go.

For QT-Developer:
If you want to staticly link Qt library you have to do the following:
  1. Download the OpenSource from the QT libraries.
  2. After you unpacked everything start the command prompt from Visual Studio.
  3. Go to the root directory of the unpacked sourcecode (the same directory where bin\ is in)
  4. Enter "configure -static" (during this process an project.sln will get created)
  5. Open Visual Studio and open the just created "project.sln"
  6. Choose the parts of QT you want to build and xo everything mentioned above to staticly link the runtime files.
If you've done that you should be able to staticly link the QT libraries.

If you don't want to link staticly, here you'll get the runtime installfiles: