Author Topic: [C++][Crinkler][glut]  (Read 28782 times)

0 Members and 1 Guest are viewing this topic.

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
[C++][Crinkler][glut]
« on: April 15, 2013 »
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:

Code: [Select]
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?

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #1 on: April 15, 2013 »
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:

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: [C++][Crinkler][glut]
« Reply #2 on: April 16, 2013 »
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:

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #3 on: April 16, 2013 »
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.

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: [C++][Crinkler][glut]
« Reply #4 on: April 16, 2013 »
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:

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #5 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

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C++][Crinkler][glut]
« Reply #6 on: April 16, 2013 »
If you're not heading for 4k you're probably happier with kkrunchy...
Challenge Trophies Won:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #7 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)

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #8 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... :-\

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C++][Crinkler][glut]
« Reply #9 on: April 16, 2013 »
to use an import lib like that you can just do
Code: [Select]
#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:

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: [C++][Crinkler][glut]
« Reply #10 on: April 16, 2013 »
Quote
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.
+1!
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #11 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!

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #12 on: April 16, 2013 »
Quote
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.
+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.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #13 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:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #14 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

Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #15 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.

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #16 on: April 16, 2013 »
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




Offline lucastar

  • C= 64
  • **
  • Posts: 50
  • Karma: 5
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #17 on: April 16, 2013 »
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

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #18 on: April 16, 2013 »
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:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: [C++][Crinkler][glut]
« Reply #19 on: April 16, 2013 »
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: