• Welcome to Dark Bit Factory & Gravity.
 

[C++][Crinkler][glut]

Started by lucastar, April 15, 2013

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

lucastar

Hi, it's me again with another issue...

I'm trying to use Crinkler with VS2005 (i tried with 2010 too), and in the moment that loads glut32.lib this happens:


1>Loading opengl32.lib...
1>Loading glut32.lib...
1>Oops! Crinkler has crashed.


I didn't find anything about this, and is taking me crazy... is glut not compatible with crinkler?

Raizor

tbh, I've never tried using glut with crinkler, but I can't see why it would cause problems. if you want to upload a sample project/sln, I'll have a look for you. I may not be able to resolve the issue, but it would at least discount the problem being specific to your setup :)
raizor

Challenge Trophies Won:

ferris

Also, you should be aware of the fact that GLUT isn't system-standard on Windows, and should probably be avoided in case of a 4k.
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

lucastar

I don't want a 4k intro, but i don't know other way to make the .lib files be inside the .exe.
I'm veeery noob at attaching resources to a .exe. Is there any other way that doesn't use VS?

Quote
tbh, I've never tried using glut with crinkler, but I can't see why it would cause problems. if you want to upload a sample project/sln, I'll have a look for you. I may not be able to resolve the issue, but it would at least discount the problem being specific to your setup

thanks, when i get home i will upload it.

ferris

Ah, I see; then let's solve the real issue instead :)

Are you building GLUT from source, or have you obtained a binary (.dll/.lib pair)?

If you're building from source, I don't think there should be any problems just popping the source in your project and firing away. In this case, uploading the project (or some simplified version of it) would be quite helpful, as someone like Raizor would be able to take a look and help you out for sure.

If you have a .lib & .dll from somewhere, however, then you can't build it all into one .exe without it depending on the .dll in the end. In this case the .lib just contains information about available methods in the .dll, and doesn't eliminate the dependency on the library at all, no matter which linker you use. So, if you really need GLUT, try building the source with your project or to a static library and link that in, or consider eliminating GLUT altogether.
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

lucastar

Quote from: Ferris on April 16, 2013
Are you building GLUT from source, or have you obtained a binary (.dll/.lib pair)?
I have included the .lib as an external library, and the dll is on Windows->System32.

Quote
So, if you really need GLUT, try building the source with your project or to a static library and link that in, or consider eliminating GLUT altogether.
I don't "really" need it, but it makes window management a lot easier. I've tried to use crinkler with another project using only opengl32.lib, but when i managed to resolve all the errors, mi .exe didn't work.

Yes, I'm pretty lost about this. As i said, i will later upload the .sln

hellfire

If you're not heading for 4k you're probably happier with kkrunchy...
Challenge Trophies Won:

Canopy

Quote from: CosmicColours on April 16, 2013
I have included the .lib as an external library, and the dll is on Windows->System32.
how are you including it?

to use an import lib like that you can just do

#pragma comment( lib, "glut32.lib" )

note: the pragma comment method only takes full paths or jus the lib name, you cant do "..\.." which is a bit annoying!


(i dont use glut, but i use glew by directly including the source into a lib in my project with my common code in and i then include my lib in my projects)

lucastar

Quote from: Canopy on April 16, 2013
how are you including it?
to use an import lib like that you can just do
#pragma comment( lib, "glut32.lib" )
I am including it as an additional dependence on the linker input in VS.
I honestly don't know how #pragma comment works... :-\

hellfire

Quote from: Canopy on April 16, 2013
to use an import lib like that you can just do
#pragma comment( lib, "glut32.lib" )
note: the pragma comment method only takes full paths or jus the lib name, you cant do "..\.." which is a bit annoying!
I must admit it looks tempting but I strongly suggest not to do it that way.
It just doesn't make sense to put linker settings into the source code.
And it's a terrible pain to fix relative paths if you ever decide to restructure a bigger project.
Challenge Trophies Won:

ferris

QuoteI must admit it looks tempting but I strongly suggest not to do it that way.
It just doesn't make sense to put linker settings into the source code.
And it's a terrible pain to fix relative paths if you ever decide to restructure a bigger project.
+1!
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

lucastar

Here is the source, in VS8.
Files are not well organized because it is a migration from a codeblocks project.
As you see, this tiny project works, now i want to pack all resources in the .exe.
Thanks!

Canopy

Quote from: Ferris on April 16, 2013
QuoteI must admit it looks tempting but I strongly suggest not to do it that way.
It just doesn't make sense to put linker settings into the source code.
And it's a terrible pain to fix relative paths if you ever decide to restructure a bigger project.
+1!

../.. only for home projects.. it is one thing i my list of things to sort out, but home code == fun code so pro/team work priorities don't matter so much!

at work we use lib paths and inc paths in vs, but choose linking via .lib either way.

its sometimes nicer to use the #pragma way as you can pic a different lib via #ifdef's  without  having to make a new build configuration. it also stops those compile errors that are release/debug only due missing out the libs in the configs.

Raizor

Quote from: CosmicColours on April 16, 2013
Here is the source, in VS8.
Files are not well organized because it is a migration from a codeblocks project.
As you see, this tiny project works, now i want to pack all resources in the .exe.
Thanks!

So, you're not planning on making a 4k intro? If that's the case, then as Hellfire says, using Kkrunchy is probably a better idea and may well give you a smaller exe file. When I've tested Crinkler vs Kkrunchy for larger exe files (~64k), Krunchy wins pretty much every time.
raizor

Challenge Trophies Won:

Canopy

does he even need that?

"but i don't know other way to make the .lib files be inside the .exe."  makes it like he doesnt know how to include an lib file full stop.

as ferris pointed out, as its an import library it will always need the .dll

lucastar

Quote from: Canopy on April 16, 2013
does he even need that?

"but i don't know other way to make the .lib files be inside the .exe."  makes it like he doesnt know how to include an lib file full stop.

as ferris pointed out, as its an import library it will always need the .dll
I don't know how to include resources in a .exe, i told it before. I want to compress my code too. I thought than crinkler was used for that.
I do know how to use .lib in a project, i know how to use VS, i know how to use glut and other non standard libraries.

Canopy

ok, so you now explicitly want to compress...

i tried your project but i'm using vs2008 sp1 and don't have glut.


what kind of resources do you want to include/embed?

i'll assume you mean a binary file like a picture, but works for model data etc

method 1
- convert it to a headerfile as a huge buffer

method 2
- stuff it in the resource table as a binary resource and use findresource(), loadresource() and lockresource() to access it

for size coding method 1 is probably far far superior




lucastar

Quote
ok, so you now explicitly want to compress...
yes i do, sorry i didn't explained myself well.
Quote
i tried your project but i'm using vs2008 sp1 and don't have glut.
you have to got glut32.dll in system32/SYSWOW64, and .lib and .h files in VS install directory.

Quote
what kind of resources do you want to include/embed?

i'll assume you mean a binary file like a picture, but works for model data etc
mmm no exactly (i don't like using pictures, i prefer code-generated drawings). i was thinking about sounds, libraries and stuff.

My trouble is: I know how to code, to use opengl, i work coding. But since i saw mi first cracktro/demo i thought: ¿How the f*** can i hear music, can i execute this .exe if there are no other files (music, libraries, images)?? And how can that file be so little??

Raizor

ok, I follow now.

rather than writing a ton of instructions on using resources in vc++, check out this. It's the sourcecode for a competition entry I made a while ago using C++ in VS 2008. It uses embedded resources for graphics and the sound, so should work as a guide for you. Have a look at the "gltLoadJPG" in "gltools.cpp", which loads a JPG file from an embedded resource.

The way I'm doing it is a bit longwinded. There are quicker way, depending on what you're loading. Have a look here for some more information on the available resource functions.


raizor

Challenge Trophies Won:

Raizor

I'm still happy to have a look at the project, but I only have VS 2012 here. So it will render the project unusable for you if I make changes to it :\
raizor

Challenge Trophies Won: