Monday, April 10, 2017

Linking the wrong library version of SOIL into an OpenGL Project

Here's a summary of what I wrote. I admit I wrote a lot for this one:

Tips on linking:

1. Know if your errors are linking errors. In Visual Studio 2015, as shown above, the errors usually come up with code numbers starting with LNK, like "LNK2001" or "LNK1120". If you know how to solve the linking errors, work from there.

2. One of the ways to solve a linking error is to have the correct bit version of the library linked in a given build. It's either 32-bit or 64-bit.


Compiling SOIL on VS 2015:

The lib/libSOIL.a library file given in the SOIL folder download doesn't work for me. I opened the VC9 .sln in projects/VC9, and built my own 32 and 64-bit SOIL.lib files instead.

------------------------------------

When I originally did the Texture tutorial on the Learn OpenGL site, I did it in 64-bit on Windows 8.1, on Visual Studio 14 (aka Visual Studio 2015). Later, when I was doing the Model tutorial also on Learn OpenGL, I ran into some .dll issues where the .exe was crashing w/ no C++ or GLSL errors. I thought using 32-bit libraries would fix it. (It didn't. I had to change power settings to High Performance. I'll write about that in a future post).

After I compiled 32-bit libraries, moved them to a new folder, and linked them to my project, for some reason I placed a 64-bit library version of SOIL.lib into my libraries folder. To make sure everything was working, I tried to do a Release build on 32-bit  (Release | x86 in the pic below). I got linking errors.




Either it took me a while to see that these were linking errors, or it took me a while to figure out it was a 32-bit vs. 64-bit "wrong library version" issue. Anyways, after a while, I figured out it was a wrong library bit version. After that, it was just compiling an actual 32-bit SOIL.lib, and putting it in the right library folder.

Anyways, I thought I'd write this to say two tips that I think would help others if they get the same library error while doing the Texture tutorial :

1. Know if your errors are linking errors. In Visual Studio 2015, as shown above, the errors usually come up with code numbers starting with LNK, like "LNK2001" or "LNK1120". If you know how to solve the linking errors, work from there.

2. One of the ways to solve a linking error is to have the correct bit version of the library linked in a given build. It's either 32-bit or 64-bit.



I also thought it'd be helpful to show how I ended up building a SOIL.lib for both 32-bit and 64-bit. Learn OpenGL again has a very nice tutorial on cmake and building libraries. SOIL goes past the cmake step and already gives you projects to build libraries from. It's that small of a difference, and the Texture tutorial even points it out. But I thought I'd still show some pics on Visual Studio 2015.

1. When you download SOIL, you'll get a zip file container one folder. Extract that folder somewhere, like your desktop. Here's the SOIL site. The zip file is under the "Download" section.

2. When you open the folder, you'll see this (at least, this is what it looks like when I wrote this).

In the lib folder, there is a libSOIL.a file. That's apparently a library file too. Like it's the exact same as SOIL.lib. According to the SOIL site, it should've worked as a linked library. It didn't for me. Maybe it's not for VS 2015, but an older VS.

Anyways, if it could work for you, I'd say you can either keep the name, or rename it to something like SOIL.lib or SOIL.a ("libSOIL" or "SOIL", it doesn't matter, just make sure to update your linker settings to match the name).


3. Instead of using the lib/libSOIL.a library file (I mention my experience w/ it above), go to the projects folder. For VS 2015, I went to the VC9 folder, the latest one. Then I opened the .sln file. Then change the version settings to Win32 or x64, and build the corresponding 32-bit or 64-bit of the solution. I'd say out of whim that building on Release seems better than Debug mode.

Though Debug or Release version shouldn't matter. I'm not sure if there's a huge difference. I've noticed in both the 32 and 64 bit builds that the Debug build's libraries are smaller than the Release build's libraries.

4. Find the .lib file, copy to your libraries folder as needed, link it to your project, and you're good to go. Here's the directories that came out for me. These all start from the VC9 folder:

32-bit:
Debug: Debug
Release: Release

64-bit:
Debug: x64/Debug
Release: x64/Release

Anyways, that's my experience with SOIL. Hope it helps someone! : )

Saturday, January 21, 2017

First Post - My Google Drive Notes Link

Hi. As you can probably guess, my name's Nic. I made this blog just to find a place to store the pics and .txt's of my personal notebooks from my drive publicly. I want to do this mainly on the offset chance that a future version of me (possibly in another life) may be able to find these notes one day. I know it sounds ridiculous haha, but it's what I believe. To be more realistic, by posting this, it makes me feel that doing these notes is at least contently meaningful in the long run, even if no one else will probably ever see these.

And if I ever have something else interesting, I'll post it either on here or on YouTube. That's definitely not my priority, though. I haven't posted a YouTube video or blogspot permanently before this (I mean, I did make some stuff, but it was either for school and I kept it private. and the other blogspot i made 1 year ago, I took it down. Just didn't feel like using it.)

Anyways, ya, here's the google drive link. I post anything I write from a notebook after I finish using it. Not from school, but from hobby notebooks (either personal thoughts, or stuff I learned for a hobby, like game dev and math). The handwriting's messy on the pics. It's for my own use. I don't write these initially with the intent of public viewing. I post on the drive irregularly and not often, but again, my priority's just putting these on the internet somewhere, not committing to a blog.

That's it. Thanks to be alive in a day where this is possible.

-Nicolas Obias

=====
(10-14-17) I've decided to clean out my entire shared Notes folder and start all over again, considering more about what I'd like to publicly share here. I've written a lot ever since I made this post. Looking back at it, there are a few personal life notes that I'm really uncomfortable posting online. I'd like to make sure to take more time to look at my life notes before putting them in the Notes folder. I've also written about notable times I've had with other people, both good and bad. I wrote them for reminding myself of things that happened in the past, and to help me consider things moving forward. To respect other people's lives (the other reason why I want to start this folder all over again), I don't want to post those notes either.

Nonetheless, I really want to post the majority of my notes. I've put honest care into all of them, and I'd like to post as much as I feel comfortable posting into that Notes folder. As I'm seeing right now, it's not just about personal life notes and people notes. I've enjoyed noting a lot about things like programming (Windows API and OpenGL) and even trying out cooking. Making notes like these I can look back on in the future has changed my life a lot, in my opinion, and I'd like to continue on with my original intention when I first made this post of sharing them. I have a lot of notes so far, so I'll add them little by little.

I'm looking at the Post settings while I'm editing this. The publication date was 1/21/17. I honestly didn't believe I'd post occasionally on my blog like I've done so far. I don't fully commit to this blog, but nonetheless, to look back at it now, I'm happy with it. Here's to more things in the future. : )

-Nicolas Obias

=====
(8-30-18)
-I won't be posting anything anymore to the Notes folder I originally shared in this post.
-
-I want to focus more on developing my own notes solely on paper where I can more easily write and draw pictures freely, and where I can think through my thoughts with them more easily instead of trying to rush to digitizing my notes and getting a lot of content online. I've found that it's easier for me to organize my notes this way instead of trying to sort them in a Windows Explorer directory listing via a naming convention for example. It's less stressful on my eyes too, over a computer screen. I have the "Screen Eye Reminder" program I made to periodically give my eyes a break from the screen (I've written about it in my "Personal Reflection" blog entry here). But I still find paper more comfortable to my eyes in the long run.
-
-I enjoy being focused on just paper again. I can be more creative with it than I can with a computer. Besides writing on it, I can tape it to a wall and cut it as I wish for example. I like having my laptop to write entries like these. (Just to say it, I'm typing this out in Notepad, and then I'm adding it to this blog entry.). And I like the convenience of the gigabytes of storage I have that I can use for anything, including instant backups of my files. Nonetheless, I find it nice to be in the mindset to use paper with no intentions of digitizing it, and to store them in a small stack in my bookshelf and pick out entries from there when I want to. It just feels nice. I don't have anything more specific than that, but at least I hoped to convey that "feels nice" phrase more clearly by describing my paper notes more.
-
-In the future, if I ever decide to post my personal notes online, I'll post them in complete thoughts and sentences. I'm already finding it a greater help to me to make my personal notes complete sentences now, instead of writing mainly small phrases and bullet points like I did in the notebooks I wrote in the past.
-If I'm mostly posting text, I'll type a new post here on my blog. If I ever make a video or something music-like, I'll post it on my YouTube channel. As of now, I've never posted anything publicly on there. Maybe one day.
-
-I'll leave whatever images of the notebooks I posted in Notes folder I linked in this post, to show what it looked like before I made the decision not to post there anymore.
-I'll also post a picture of what my paper notes look like right now, for the same "for the record" purpose. I've jotted down a lot of single-sided paper notes on chess, as I'm so interested in it right now. I'm pretty sure I won't keep all of those notes as time goes by, so I have them in a separate pile (in the picture, they're the pile in the right side of the two I show). I also printed out my own paper chess board and pieces, both a small one and a big one that I taped together. I'm really into chess right now, and I find it nicer to have a paper board to look at instead of one on a computer screen. I'll add those to the picture too. Anyways, that's all I have. Until the next post.

-Nicolas Obias