A stable free IDE

Posted By: Dark_samurai

A stable free IDE - 04/15/08 07:27

Hi!
I wrote a c++ plugin with the DEV-C++ IDE. But I noticed that the complier has a lot of strange bugs. Because of this I'm looking for a free Compiler/IDE which is able to compile dlls for gamestudio (I'm not sure if this can be done with every compiler) and is stable enough to write a big plugin without lot's of annoying compilerbugs.
Which IDE would you use or do you use?
Are there any problems if I recompile my dll with another compiler?

Dark_Samurai
Posted By: MichaelGale

Re: A stable free IDE - 04/15/08 08:10

Visual C++ 2005/2008 Express Edition?
Posted By: bstudio

Re: A stable free IDE - 04/15/08 09:55

I got codeblocks to work, it took a lot of effort though
Posted By: Dark_samurai

Re: A stable free IDE - 04/15/08 10:30

 Quote:
Visual C++ 2005/2008 Express Edition?


With the express edition it's not possible to compile dlls.
Posted By: Excessus

Re: A stable free IDE - 04/15/08 11:05

You're wrong, you can compile dlls.
Posted By: MichaelGale

Re: A stable free IDE - 04/15/08 11:59

Yep. You just need the WinSDK as well (which is available on the microsoft website), because it is not included in the installer.
Posted By: Ambassador

Re: A stable free IDE - 04/15/08 14:58

What do you mean by "compilerbugs"?
Posted By: Dark_samurai

Re: A stable free IDE - 04/15/08 15:51

 Quote:
What do you mean by "compilerbugs"?


Correct written code doesn't work. For example I have many problems with the type short and scanf/sscanf, altough the same code works in other IDEs.

 Quote:
Yep. You just need the WinSDK as well (which is available on the microsoft website), because it is not included in the installer.


Oh, thats the reason why the button dll was grayed out [is this english???].

I had the express edition but something went wrong with my registration.
So I will try to install it again...

Dark_Samurai
Posted By: Altimeter

Re: A stable free IDE - 04/15/08 18:28

with VC++2008 express you can start right away.
No need for extra downloads. You can compile dlls for 3DGS and can use these in commercial products. I am quite happy with it.
Posted By: Dark_samurai

Re: A stable free IDE - 04/16/08 16:18

 Quote:
with VC++2008 express you can start right away.
No need for extra downloads. You can compile dlls for 3DGS and can use these in commercial products. I am quite happy with it.


I installed it again and again I can't create dll projects... I click [new project] and than I can't find dll as template. There is nothing under win32 nor under CLR nor under general. (I don't know if these buttons are correct translated, because I have the german version of VC++ 2008).

Do I still need the WinSDK?

Dark_Samurai
Posted By: MichaelGale

Re: A stable free IDE - 04/16/08 16:26

You should be able to create a Console Application (Win32) and to change the output type to a dll (Library) in the settings of the project. You should get the WinSDK though as it comes with a DLL template that gives you a better start than the Console Application template and it comes with all the libraries and headers you will need.
Posted By: Dark_samurai

Re: A stable free IDE - 04/16/08 16:30

Ok now I get it!
Thanks to all of you for your help!

Dark_Samurai
Posted By: Dark_samurai

Re: A stable free IDE - 04/16/08 17:16

Now I have the problem that I'm too stupid to get the sampledll working (with VC). I've linked the adll.lib and copied all files (adll.h, afuncs.h, atypes.h, avars.h, adll.lib, SampleDll.cpp) into my folder. But when I compile it it says: "fatal error C1010: Unerwartetes Dateiende während der Suche nach dem vorkompilierten Header. Haben Sie möglicherweise vergessen, im Quellcode "#include "stdafx.h"" einzufügen?"
In English: "fatal error C1010: Do you forgot to include "#include "stdafx.h"" into the sourcecode?"

-> I wrote "#include "stdafx.h"" and another error appeared: "Datei (vorkompilierte Headerdatei) kann nicht geöffnet werden: "Debug\test.pch": No such file or directory"
In Enlish: "File (precompiled headerfile) can't get opened: "Debug\test.pch": No such file or directory"

What am I doing wrong? Has anyone a running example?

Dark_Samurai
Posted By: Quad

Re: A stable free IDE - 04/16/08 17:56

when im creating a dll i follow this steps, and dont get any errors:

open vc++ 2008 xpress-> click project(next to create)->select win32 from left->select win32 project->Enter a name->ok->click next->chose dll->Click finish

then add other headers/spurces to the project
Posted By: Dark_samurai

Re: A stable free IDE - 04/16/08 18:08

Ok, I did it like you did it.
What headers do you include and how? Do you only write the includes into the source and copy the files into your folder or do you also include them into your project (left side, project manager)?
And how do you include the adll.lib? Is it correct if I do it like this: [project]->[settings]->[Linker]->[Input]->and then into the first line: "adll.lib"? And of course I copied the adll.lib into the folder.

Dark_Samurai
Posted By: Altimeter

Re: A stable free IDE - 04/16/08 19:16

You should set the project settings to not use precompiled headers.

The following settings work fine for me, but you might want to play around with some of these.

Projekt-> ...Eigenschaften-> Konfigurationseigenschaften
1.)Allgemein->
Konfigurationstyp: Dynamische Bibliothek(.dll)
Windows Standardbibliotheken verwenden
ATL wird nicht verwendet
Multi-Byte Zeichensatz verwenden
Keine Common Language Runtime Unterstützung
Keine komplette Optimierung
2.) Debugging->
Befehl: C:\Programme\GStudio707\acknex.exe or wherever your acknex is located
Befehlsargumente: "C:\ ...\mySuperC-LiteProgram.c"
(these two lines will launch your C-Lite Program in the IDE as debugger (STRG F5))
3.)C++
Allgemein
-Zusätzliche Includeverweise: Feld bleibt leer
#using Verweise: leer
Debuginformationsformat: Programmdatenbank (/Zi)
Startbanner unterdrücken : Ja
Warnstufe Level3
Nach 64Bit Portabilitätsproblemen suchen Nein
Warnungen als Fehler: Nein
Unicode: Ja
Codegenerierung
-Stringpooling: Nein
Minimale Neuerstellung Nein
C++ Ausnahmen:Ja
Überprüfen von kleinen Typen: Ja
Vollständige Laufzeitüberprüfung: Standard
Laufzeitbibliothek: Multithreaded-Debug-DLL(/MDd)
Vorkompilierte Header verwenden: NEIN
4.)Linker
Allgemein:
Ausgabedatei: $(OutDir)/mySuperDLL.dll
Status anzeigen Nicht festgelegt
Version: bleibt leer
Incrementelles Verknüpfen: Nein
Startbanner unterdrücken: Ja
Importbibliothek ignorieren: Nein
Ausgabe registrieren: Nein
Umleitung pro Benutzer : Nein
Zusätzliche Bibliotheksverzeichnisse: adll.lib
Bibliotheksabhängigkeiten verknüpfen: Ja
Bibliotheksabhängigkeitseingaben verw. : Nein
Unicode Antwortdateien: Ja

Eingabe:
Zusätzliche Abhängigkeiten: adll.lib
Standardbibliotheken ignorieren: Nein
Bibliothek ignorieren: libc.lib, LIBCMT

Now try to compile the sample.cpp file. You should find it in the debug-subfolder.
Copy it into your acknex plugin directory.
Posted By: Dark_samurai

Re: A stable free IDE - 04/17/08 16:59

Thanks for this detailed description, now this thing (compiling a gsdll) works.

I started now to recompile my enet.dll with VC++, but it seems like I don't include the enet things correct. I did it like they said on the webside (enet.bespin.org/Installation.html): I opened the enet project and compiled it -> I got a enet.lib file. I copied this file into the lib folder of VC++, linked it in my dll-project and also linked the ws2_32.lib. But now I have the problem, that when I call one of the enet functions (like enet_initialize) i get an error: "enet_initialize can't found".
Now my question: If I include a static libary, do I also need to include the headers which I compiled into the lib in my dll-project? Does anybody have experiance with using enet in VC++?
And the gag is, that with Dev-C++ it worked after doing that (and some help of nfs42). But in general I did it like that, but in VC++ it don't works like this...

Thanks!

Dark_Samurai
Posted By: TWO

Re: A stable free IDE - 04/18/08 09:47

Sure, you have to include the headers (Actually in most cases only the project-name.h, e.g. enet.h).
Posted By: Dark_samurai

Re: A stable free IDE - 04/18/08 11:24

Ok i included the enet.h, but now I get a lot of new errors: "enet.lib(win32.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__timeBeginPeriod@4" in Funktion "_enet_initialize"."
English: "enet.lib(win32.obj): error LNK2019: reference to a not decomposed extern symbol "__imp__timeBeginPeriod@4" in function "_enet_initialize"."

Maybe I did something wrong at compiling the enet.lib?

Dark_Samurai
Posted By: TWO

Re: A stable free IDE - 04/18/08 11:51

Seems that you forgot to include winmm.lib
Posted By: Dark_samurai

Re: A stable free IDE - 04/18/08 18:58

Yep, that was the problem. Thanks!

But like I expected there is still another problem with using sscanf_s.

In Dev-Cpp the following Code worked:

DLLFUNC void string_test()
{
char buffer[50];
short reseiver;

sprintf_s(buffer,50,"%d",10);
sscanf_s(buffer,"%d",&reseiver);
}

But if I use this function in GS i get this runtime error:
Debug Error!

Run-Time Check Failure #2 - Stack around the variable 'reseiver' was corrupted.

What am I doing wrong?

[edit]I found out that this problem only occurs in a dll. If I build the whole thing as console application everything works. Maybe some settings are affecting this.

Dark_Samurai
Posted By: Dark_samurai

Re: A stable free IDE - 04/19/08 13:32

I uploaded a testproject which should show my problem. There are 2 folders, one with the VC++ 2008 project and one with the C-Script test. Just open test.wdl with SED and than debug->set main to current and then debug->testrun. Than you will notice my problem.
You will need winrar to unpack.

Link: rightclick->save as

Thanks for your help!

Dark_Samurai
Posted By: Dark_samurai

Re: A stable free IDE - 04/20/08 08:14

I found out that this problem only occurs, when reseiver is short. With int everything works.
It would be interesting why this doesn't work with short...

Dark_Samurai
Posted By: Joey

Re: A stable free IDE - 04/20/08 12:10

you could try adding a __asm pop ax or a __asm push ax after your function, if dev-cpp supports that.
Posted By: Dark_samurai

Re: A stable free IDE - 04/21/08 18:21

It works now.
By the way I'm using VC++ 2008, not Dev-Cpp now.

And after some testing I found out, that a dll written with VC++ doesn't open correct on some computers. I tested it on 4 different pc and only on one it' was opened. Did somebody already had this problem? What are typical mistakes when this problem occurs? Wrong headers/libraries, wrong project settings?

Dark_Samurai
Posted By: Excessus

Re: A stable free IDE - 04/21/08 20:10

The users of your dll must have the VC++ 2008 redistributable libraries installed.
Posted By: Dark_samurai

Re: A stable free IDE - 04/22/08 06:28

Are there any libaries which are already pre-installed on the most systems?
Because I don't want that my end users have to install more than my game it self...

Dark_Samurai
Posted By: Dark_samurai

Re: A stable free IDE - 04/22/08 16:00

I installed the libraries on the other pcs but it still doesn't work.
If I would use an older Version of VC++ (like 2005), would there also be such a problem? Which Version should I choose?

Dark_Samurai
Posted By: TWO

Re: A stable free IDE - 04/22/08 16:16

I think that behavior of microsoft appeared in vs service pack 1.

I'm not really sure, but not using "multithreaded-dll" and instead "multitreaded" in C++/Codegeneration in the compiler options may fix the problem.
Posted By: Dark_samurai

Re: A stable free IDE - 04/22/08 16:30

Ok I tried that, but with the new settings I get this error:

"mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\enet.dll.embed.manifest". Wrong parameter."

Dark_Samurai
Posted By: TWO

Re: A stable free IDE - 04/22/08 16:42

Make a full rebuild.

Edit:
If this does not help, including MSVCR80.dll (and maybe a handful more dlls) in the publish folder should solve the problem.
Posted By: Dark_samurai

Re: A stable free IDE - 04/22/08 16:55

Thanks, now it works!!!

There is only one last small question until this thread can be closed: How can I setup my dll so that it gets a version and an informationtext? In Dev-Cpp this was under Projectsettings, but in VC++ I can't find anything like that...

Dark_Samurai
Posted By: TWO

Re: A stable free IDE - 04/22/08 17:02

In the IDE, add a resource file (.rc), now the left project window switches to the resource window. Here you add a new resource type, just called "version" where you can edit this settings.
Posted By: Dark_samurai

Re: A stable free IDE - 04/23/08 17:04

It seems like this is not supported with the express version...

Thanks for your help!

Dark_Samurai
Posted By: Tor

Re: A stable free IDE - 05/06/08 14:16

 Originally Posted By: Dark_samurai
Yep, that was the problem. Thanks!

DLLFUNC void string_test()
{
char buffer[50];
short reseiver;

sprintf_s(buffer,50,"%d",10);
sscanf_s(buffer,"%d",&reseiver);
}

But if I use this function in GS i get this runtime error:
Debug Error!

Run-Time Check Failure #2 - Stack around the variable 'reseiver' was corrupted.

What am I doing wrong?


Dark_Samurai


Probably because the function is expecting a double which is 4bytes and you gave it a short which is 1-2bytes depending on compiler/Os.

Stick with ints/floats, they're faster in almost all cases. 2Byte data types don't help unless you're using them inside classes to save space. Things are optimized more efficiently if all the data you're using is 32bits for the most part.

Can I recommend you try out the STD::STRING stuff? char*'s and the stdlib cstring manipulators are very very dangerous, I can't tell you how many times I've blown up the heap/stack with them \:D .
Posted By: Dark_samurai

Re: A stable free IDE - 05/06/08 15:39

 Quote:

Can I recommend you try out the STD::STRING stuff? char*'s and the stdlib cstring manipulators are very very dangerous, I can't tell you how many times I've blown up the heap/stack with them \:D .


Do you mean using an index that doesn't exit? Because of that I use for example sprintf_s (all with _s) which is save in this case (because of an parameter that holds the size).

 Quote:

Probably because the function is expecting a double which is 4bytes and you gave it a short which is 1-2bytes depending on compiler/Os.

Stick with ints/floats, they're faster in almost all cases. 2Byte data types don't help unless you're using them inside classes to save space. Things are optimized more efficiently if all the data you're using is 32bits for the most part.


In school they told us not to use int because it's size depends on the compiler. But with int every thing works, because of that I will use int in the future.

Dark_Samurai
Posted By: Tor

Re: A stable free IDE - 05/07/08 08:36

Unfortunately, yes, int can vary in size depending on compiler, but if you're using a comiler on at LEAST a 32bit platform that was made in the last 10 years or so, you can assume int is 4bytes. I know for a fact you can in VS/Borlandbuilder 6+.

What the heck do they tell you to use besides an int? long?

It's not crashing on sprint_f, I believe it's wigging out on the accessing of sscanf_s.
© 2024 lite-C Forums