Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 513 514 [515] 516 517 ... 796

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

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7710 on: August 28, 2015, 05:35:51 pm »

in the debug folder because it's probably a debug compile

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7711 on: August 28, 2015, 05:38:39 pm »

Just a quick question to bump this back up, but how can I run a program without having to run it through Visual Studio? (program is in C++ by the by, if that matters in this case)

at some point you might want to create a release configuration, which will package all the stuff outside the project ready for distribution

https://msdn.microsoft.com/en-us/library/wx0123s5.aspx
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7712 on: August 28, 2015, 06:11:04 pm »

Use a different compiler?
No clue.  But anyway I found the .exe file, which was in the Debug folder for some reason. huh.

That's the standard place that exes get put when they are compiled. The two build types are debug, and release. Debug version is both slower and much bigger (it has embedded debug info). In VS by setting the build mode to "release" then you get a faster, smaller exe, which funnily enough goes in a "release" folder, but it lacks the embedded debug info so you can't click through it line by line inside visual studio to see which line of code is causing crashes. Which is not an issue if you're building something out for the end-user, so go for "release".
« Last Edit: August 28, 2015, 06:13:42 pm by Reelya »
Logged

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7713 on: August 28, 2015, 06:46:18 pm »

Important note, but depending on your IDE, your makefile, your configuration settings, and so forth just changing the little setting from "debug" to "release" does not always guarantee that you are actually doing the things that let other people run it (namely doing static library usage and linking). This is especially common if the code was actually generated elsewhere and you just imported it, such as with open-source projects, as opposed to code projects you generated yourself.

(Also it doesn't apply on OS X, which uses a completely different method due to Apple hating static libraries and using frameworks/dynamic libraries instead).

That said if you are just asking about running the program on the same computer, but not through your IDE, lots of times you can just double-click the .exe that you compiled and it should run just fine (though sometimes you might need to move the .exe from the Debug/Release folder into the main folder by hand first, depending on how you set up your linking and whatnot).
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7714 on: August 28, 2015, 07:07:16 pm »

I still don't understand linking and how to set it up, really.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7715 on: August 29, 2015, 04:50:17 am »

I am trying to get the binaries for Boost.

It apparently involves downloading the source, downloading something called bjam, running bjam creates bootstrap.bat, and running bootstrap.bat creates b2.exe. Running b2.exe apparently compiles the binaries, but I have no idea where the hell it put them.

Why the hell are libraries always such a pain in the ass?

EDIT: Apparently bjam wasn't a neccessary part of the process(?). Which begs the question of why the the guide told me download it? Everything is contradictory everywhere.
EDIT2: Yay! It now makes DLL's...for MSVC. Changing to the GCC toolchain apparently doesn't work because apparently windows doesn't see g++.exe even after I added the folder to the system path. This is stupid.
EDIT3: I was adding the folder to the path wrong. If it doesn't work, then I'm just gonna go play TF2 and sulk.
EDIT4: Holy fuck it works now.
EDIT5: Aaaand I can't get the linker to work.
« Last Edit: August 29, 2015, 06:00:39 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7716 on: August 29, 2015, 10:57:16 am »

that's pretty much my experience with trying to get libraries to work, yeah.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7717 on: August 29, 2015, 12:11:04 pm »

Yup. Gave up on that.

I instead found some cereal that's just headers, meaning no linking. So now I can make snazzy save files and stuff. The only reason why I wanted Boost was for the serialization library.

So kids, when you run into difficulties, give up and it'll all magically work out.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7718 on: August 30, 2015, 01:26:55 am »

I compiled Boost on Windows once... can't remember how but I remember it took hours (of compiling time, after spending hours getting it to compile) and was way more trouble than it was worth.

These days I generally avoid Boost because it put such a sour taste in my mouth.  I have, however, had more success with the header only libraries.  They don't have to be compiled into linkable libraries and just have to be included.  I've had much more success with that.

On the other hand, it does drive up the compilation time quite noticeably...
« Last Edit: August 30, 2015, 01:30:17 am by Telgin »
Logged
Through pain, I find wisdom.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7719 on: August 31, 2015, 06:13:24 am »

In Java, how can I create a system whereby I can read and write an object to the same file multiple times? I want to create a program where the user can write to the file, read from it, change something and overwrite the file, then load the modified file back into the program. My google-fu has failed me.

EDIT: Oh god I'm awful at this. So I'm testing the read/write stuff by reading the first element of an array in the class that I'm writing to the file. My program appeared not to work, because it was only writing the first element once; subsequent writes weren't changing the value of the first element. Well, that's because I was appending to the array, not overwriting the first index. I ran around in circles and read tons of documentation... and the problem was not even related to the file IO stuff. As usual, the program was doing exactly what I had told it to; I was just an idiot.
« Last Edit: August 31, 2015, 06:27:11 am by itisnotlogical »
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7720 on: August 31, 2015, 06:32:14 am »

Generally the first thing you should always try is debug statements. I would try this 99% of the time before relying on Google.

debug statements with variables such as "Storing value X in array slot Y", "writing array value Y to file" would have shown you the error in about 2 seconds. Basically throw debug statements in all over the place and output the values that are being played with, this often shows up subtle errors in your code or logic. and when you're done with the debug statements comment them out rather than deleting them. This makes it easy to double-check the logic if something else breaks that function later. You can check that it's still generating correct values internally.

Another approach is to make sure you comment the code extensively. If there's a bit of code which seems to be doing the wrong thing, write pseudo-code comments that explain what it is doing, in plain English. Seeing it in English and comparing that to what it's actually doing can highlight coding errors.
« Last Edit: August 31, 2015, 06:41:11 am by Reelya »
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7721 on: August 31, 2015, 06:42:01 am »

Thanks Reelya. That feedback was actually really helpful; it's very easy to learn how to program, as in learning the syntax of a language, but it's difficult to learn how to be an effective programmer.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7722 on: August 31, 2015, 06:53:01 am »

Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7723 on: August 31, 2015, 02:31:19 pm »

Generally the first thing you should always try is debug statements. I would try this 99% of the time before relying on Google.

Back when I was in university, I knew a guy who used to debug by writing poetry in debug statements.  He'd know where his program was crashing by where in the poem it stopped.  :)
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #7724 on: August 31, 2015, 02:38:41 pm »

and when you're done with the debug statements comment them out rather than deleting them.
Important note about this, but if you are commenting out debug code make sure to properly mark it as "DEBUG CODE" or something similar. There is nothing more confusing than coming across a block of commented out code and having to stop everything to figure out what the heck it is and if it's even still valid anymore. (And often commented out code is one of the first things to break in any project, which can be quite a pain if someone tried to use it later, and gets in the road while it's commented out).
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.
Pages: 1 ... 513 514 [515] 516 517 ... 796