Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 81 82 [83] 84 85 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 909064 times)

Glowcat

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1230 on: February 03, 2012, 05:05:59 pm »

Did you set it up properly? If you're using Visual Studios 2010, you only need to hit Properties -> VC++ Directories and set both the Include and Lib directories (x86 subfolder in Lib)

Then under Linker -> Input -> Additional Dependencies you add:
SDL.lib
SDLmain.lib

EDIT (the entire process with visual aids): http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet2010e/index.php
« Last Edit: February 03, 2012, 05:09:43 pm by Glowcat »
Logged
Totally a weretrain. Very much trains!
I'm going to steamroll this house.

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1231 on: February 03, 2012, 05:10:35 pm »

(x86 subfolder in Lib)
Sure 'bout that? I have a 32bit system so I chose x64 NEEEVERMIND I know that I'm an idiot.



Oh hey so it worked.

Weird. Getting a different error now, but at least that one's gone.
« Last Edit: February 03, 2012, 05:12:52 pm by Darvi »
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1232 on: February 03, 2012, 05:27:44 pm »

Don't worry.  We're all idiots.  Some more often than others...

Anyway, a Linker is the thing that takes code from a library and plugs it into your code.  It kind of helps for using external libraries.

So what error are you getting now?
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1233 on: February 03, 2012, 05:30:41 pm »

Don't worry.  We're all idiots.  Some more often than others...
It's actually a mistake I do all the time :V

Quote
Anyway, a Linker is the thing that takes code from a library and plugs it into your code.  It kind of helps for using external libraries.
I already checked wikipedia et al. for an explanation. Comprehension: N/A

Quote
So what error are you getting now?
LNK1104. Basically, it cannot find SDL.lib.
The problem with googling for a solution you only get posts on random forums from people who assume that whoever reads their posts knows exactly what to do.

I'm currently checking my settings and stuff.
Logged

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1234 on: February 03, 2012, 05:47:57 pm »

Aaaand fixed.

If some other sod googles for a solution, Linker>General>Additional Lybrary Directories = whereverSDLis\SDL\lib\x86
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1235 on: February 03, 2012, 07:09:25 pm »

Hey Errol, before I forget, you should change one of your lines to this
Code: [Select]
bi = ImageIO.read(new File(@"./img/tileclose.png"));

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1236 on: February 04, 2012, 12:11:32 am »

Perhaps I'm just too tired to spot my mistake, but is there any reason why this program won't do simple multiplication?
Spoiler (click to show/hide)
Eventually, this thing is supposed to figure out exactly how many dollars, quarters, dimes, etc you have, but first I need cents. It won't give me cents, just a 0.00.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1237 on: February 04, 2012, 12:17:58 am »

You need to put the things you are printing after the format string: printf("\n You have %.2f cents. Thank you!\n"); is very unsafe as not having the right number of arguments in a printf statement is undefined behaviour.
Logged

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1238 on: February 04, 2012, 12:21:04 am »

How the hell did I miss that...
double facepalm;
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1239 on: February 04, 2012, 12:34:17 am »

Ok, new problem. I made sure that cents was in the printf statement, like this:
Code: [Select]
printf("\n You have %.2f cents. Thank you!\n", cents);But then, I got this:
Spoiler (click to show/hide)
WHAT.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1240 on: February 04, 2012, 12:58:41 am »

Check what num1 contains after the scanf().
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1241 on: February 04, 2012, 01:07:53 am »

I'm not sure if there's a specific way to do that, so I just added another printf statement to display num1.
It gave me the same long-ass number, maybe minus a couple of zeros.

Not sure how 5 translated into a number which possibly outnumbers the stars in the universe, but it did. And I was doing so well on Thursday...
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

RulerOfNothing

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1242 on: February 04, 2012, 01:22:17 am »

Well, it turns out that you need to tell scanf that you want to read into a double variable, so you could either change them to floats or change the scanf statement to scanf("%lf",&num1);. (that's a lowercase L before the f btw)
Logged

Realmfighter

  • Bay Watcher
  • Yeaah?
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1243 on: February 04, 2012, 01:22:49 am »

Don't think anyone's posted it yet, the people who did the AI course on the internet are doing an introduction to programming class.

Looks interesting.
Logged
We may not be as brave as Gryffindor, as willing to get our hands dirty as Hufflepuff, or as devious as Slytherin, but there is nothing, nothing more dangerous than a little too much knowledge and a conscience that is open to debate

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1244 on: February 04, 2012, 01:29:21 am »

%lf worked. I dunno why, since my book says to use %f for doubles and %lf for long doubles, but it works.

What's worse, the textbook doesn't seem to mention what the difference between the two is.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread
Pages: 1 ... 81 82 [83] 84 85 ... 796