Forum

How do I compile C?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Postby Feared » Fri Dec 10, 2010 12:58 am

Sajt wrote:
Feared wrote:@Sajt, Slower? What? Who? When? Where? Since when was VS2010 slow? It's nice and snappy/quick for me. The IntelliSense is wonderful now. Have you tried VS2010 outside of the beta? It's drastically improved since.


Every version of Visual Studio compiles more slowly than the last. If I make a little change to one file and recompile my current project (which totals probably less than 30,000 lines of code), it takes three to five seconds to link it and everything. MSVC6 could probably rebuild the whole thing in that time. (Of course, MSVC6 didn't optimize nearly as well.)

You also have to deal with half-second lags everytime the IntelliSense is consulted. But I think this is worth it, because in MSVC2008 the Intellisense was totally broken. It could (aka it DID) get "corrupted" and only show stuff that was six months old, even if you deleted the .ncb file (there must have been another one hidden somewhere...) I read some Visual Studio dev team blog post that mentioned that they totally rewrote the intellisense system.

There was also a change in the auto-indenting which I find annoying. But, within a few weeks you get used to it (you forget that it could be better).

Other annoying things: you can't press Escape to get out of the auto-hiding output window, unless your mouse is in the right place, apparently. Also, sometimes the text of the output window gets painted on the source file window and you have to scroll up and down to fix it. And what was initially most annoying: you can't use the Terminal font anymore. Terminal was able to achieve very small font sizes without antialiasing or looking like crap, so you could see more on your screen. MSVC2010 forces me to use a relatively big Courier or Lucida Console based font as the smallest possible option. Maybe there are ttf Terminal variants out there, who knows. Also, there seems to be some problems with the debugger, but I'm not sure yet. I can't seem to look up locals in any other than the topmost stack frame.

So there are a handful of annoying glitches/features. But MSVC2008 also had roughly the same amount of such things. They just exchanged them for new ones. VC2010 is an upgrade though because the Intellisense works, and bad Intellisense is worse than no Intellisense... And to answer your question, I didn't try the beta.

I have no idea what Code::Blocks is so I can't comment on that.

Sorry, just realized this thread was about compilers and not IDEs. Or maybe it was just worded badly and it was actually about IDEs. I don't know.

edit: A question. Those red squiggly lines are cool, but do you know how to make them not report C++ errors in C code? I know it's good practice to occasionally compile your C code as C++ and get rid of the warnings, but for the time being it's annoying that all boolean expressions that are assigned to my "bool" enum are squigglized.


You're right about it linking slower, but it optimizes it so well. It's actually a little astonishing how well compared to other IDE's. I personally don't mind the 5 second linking for optimization (which you can turn off, it makes linking much faster if you do).

Half second lags? Maybe I didn't notice it, even if it is there it's also worth it I feel. Not to mention you CAN turn off Intellisense if that's such a big deal to you.
A change in auto-indenting? Did I miss that? It feels like the same indentations in 2005 and 2008.

Okay, I'll give you this. The auto hiding windows are annoying as hell. Hold on, the text gets painted on the source window? Since when? Sounds like a bug to me. I enjoy the new fonts, easier for me to read. It's nice on my eyes, but I also have 25.5" monitor as well, though. They should give you an option for terminal, though, that's a bit silly.

I my self have never had an issue with VS2010's debugger. Maybe you're doing something wrong? Not too sure.
I find it interesting that you've had so many bad experiences with VS2010. I've been using it since early beta and my issues are all pretty minimal or have been patched/fixed.

I've always had a problem with them not reporting properly on C but then again it is called Visual C++ and not Visual C/C++.

Edit:
I've been trying to use Code::Blocks for the past few hours. What the fuck? Can I not manage my projects in the project manager correctly like in VS? Seriously it feels really weird. Maybe I'm doing something wrong.
Last edited by Feared on Fri Dec 10, 2010 1:01 am, edited 1 time in total.
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby revelator » Fri Dec 10, 2010 12:59 am

wrap the boolean call in ifdef __cpluplus extern C { ?

if i understood the question correctly that is.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Mexicouger » Fri Dec 10, 2010 1:11 am

I got code blocks setup and have been trying the exercise that I have so eagerly awaited to do. CodeBlocks seems simple to use, and I have found out to compile and I can test my code. When I setup it asked me for something. It found a GCC on my laptop(I am thinking cygwin) and I guess I run with that. Is that alright to use? Or is there a better one you suggest that is easy to install
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Sajt » Fri Dec 10, 2010 1:22 am

Well, powdered toast man,

Feared wrote:A change in auto-indenting? Did I miss that? It feels like the same indentations in 2005 and 2008.


When you move the cursor to a blank line, the cursor shows up indented even if there's no actual whitespace in the file. It's kind of annoying, but it's more "different" than "worse". I'm pretty much used to it by now.

Feared wrote:Okay, I'll give you this. The auto hiding windows are annoying as hell.


I liked them in MSVC2005/8, but in those versions escape would (almost) always get rid of it and you wouldn't have to use the mouse. MSVC6 was the nicest, though...

Feared wrote:Hold on, the text gets painted on the source window? Since when? Sounds like a bug to me.


Well, for one thing I disabled hardware-accelerated windows or whatever in the settings. This option was on by default... perhaps the bug doesn't occur when it's on.

Feared wrote:I enjoy the new fonts, easier for me to read. It's nice on my eyes, but I also have 25.5" monitor as well, though. They should give you an option for terminal, though, that's a bit silly.


Maybe it's a good thing that I don't keep using 8-pt Terminal on a 17" monitor at 1280x1024, if I don't want to need glasses someday. The worst thing, though, is that without 8-pt Terminal font, the formerly-indispensable split-screen feature is completely useless, because each half of the screen only fits about 60 columns on my monitor.

Feared wrote:I find it interesting that you've had so many bad experiences with VS2010. I've been using it since early beta and my issues are all pretty minimal or have been patched/fixed.


Well, most of these things were major nuisances when I first installed it. But even then I thought to myself that they're probably just things to get used to. I'm more or less comfortable in MSVC2010 now. It's slow... and its UI design is ugly and wastes tons of screen space... and it has some problems... but meh. Soon I'll forget that some of these things were once better.

reckless wrote:wrap the boolean call in ifdef __cpluplus extern C { ?

if i understood the question correctly that is.


The proper solution would probably be to do something like that to the bool typedef... or just use a typedef int for bool instead of an enum (C++ apparently doesn't like implicit "casting" between enums and "true" booleans)
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Feared » Fri Dec 10, 2010 1:47 am

Sajt wrote:Well, powdered toast man

Well, Sajt man.

Sajt wrote:When you move the cursor to a blank line, the cursor shows up indented even if there's no actual whitespace in the file. It's kind of annoying, but it's more "different" than "worse". I'm pretty much used to it by now.

Ah, I see what you mean. I've gotten use to it I guess.

Sajt wrote:I liked them in MSVC2005/8, but in those versions escape would (almost) always get rid of it and you wouldn't have to use the mouse. MSVC6 was the nicest, though...

I hated the way MSVC6 felt, not really sure why. Something always bugged me about it, though.

Sajt wrote:Well, for one thing I disabled hardware-accelerated windows or whatever in the settings. This option was on by default... perhaps the bug doesn't occur when it's on.

I've disabled this as well and still have never seen this. Maybe I'm just lucky.

Sajt wrote:Maybe it's a good thing that I don't keep using 8-pt Terminal on a 17" monitor at 1280x1024, if I don't want to need glasses someday. The worst thing, though, is that without 8-pt Terminal font, the formerly-indispensable split-screen feature is completely useless, because each half of the screen only fits about 60 columns on my monitor.

Yeah, that sounds like it would wreck my eyes, I've always changed my text editor settings in any editor. I usually 'invert' the colours and change the font to Consolas or Verdana depending on what I'm doing. 1280x1024? Running 1920x1200 so I'm not surprised you're running out of screen space. Although I also move the panels around and scale them for optimal screen space.

Sajt wrote:Well, most of these things were major nuisances when I first installed it. But even then I thought to myself that they're probably just things to get used to. I'm more or less comfortable in MSVC2010 now. It's slow... and its UI design is ugly and wastes tons of screen space... and it has some problems... but meh. Soon I'll forget that some of these things were once better.

I still don't think it's slow. The UI design to me is fairly nice. It is customizable by the way. I can't stand how VS2010 looks by default. Then again I'm not fighting for screen space.
Anyways, glad you're getting use to VS2010. It's superior. :D
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby Baker » Fri Dec 10, 2010 2:41 am

Sajt wrote:I have no idea what Code::Blocks is so I can't comment on that.


Image

Code::Blocks is a rather mature, open source IDE that can be installed optionally with a ready-to-go Code::Blocks + MinGW compiler. Runs on Windows and Linux with most of the features you expect ... also has a beta OS X version.

qbism's engine uses it. FitzQuake 0.80 SDL uses it. Quakespasm uses it. It is very good for a free and open source IDE.

Feared wrote:Edit:
I've been trying to use Code::Blocks for the past few hours. What the fuck? Can I not manage my projects in the project manager correctly like in VS? Seriously it feels really weird. Maybe I'm doing something wrong.


In my opinion, using Code::Blocks is easier if you have some multi-platform experience. Visual Studio holds your hand a bit and with Code::Blocks --- unless you are using someone else's project file --- you do have to have familiarity with what is going on in the compile process to build a project from scratch.

For my purposes, that won't be relevant because someone will just be opening my Code::Blocks project file and likely making minor modifications and compiling. They won't need to set it up, mark the libraries and compiler flags, etc. The setup isn't the same as Visual Studio.

Now ... at first you might be thinking: "Why would I want to experiment outside the Visual Studio island?"

Some reasons:

1. Most non-Windows operating systems use gcc/g++ or some variant of gcc/g++ to compile (almost all of them, really.). And as time progresses, desktops will be a less influential part of the programming ecosystem. Phones, portable devices, tablets, consoles and of course the non-Windows desktops like the Mac Mini I'm typing this post on.

2. The leveling up experience. At first, when I learned to compile on Linux or worked with OS X, I was intimidated. It was tough. And then when I worked with FlashQuake, multiplatform stuff started to sink in. And then when I worked with the PSP, it *really* started to sink in. Suddenly, in retrospect I started to understand Linux and OS X far better. I ended up busting out a few C++ books --- one was a Microsoft one and one was a non-Microsoft platform one --- and then things really started to fall in place. The whole experience made me stronger not just with non-Windows operating systems but with Visual Studio as well --- I started thinking about what the compiler was doing, how the stack figured into the efficiency of functions. Plus the gcc has different warnings and if you want to make the warnings disappear, you can research the warnings and find out how truly proper code increases the integrity of the source code.

Anyways ... just explaining my experience. The future is filled with a ton of devices and most of them will be using gcc as the compiler and will have a Linux-like file system. The PSP does, for instance. The Wii. The Pandora. OS X. The iPhone. Android OS. And on and on ...

Whenever I have the next version of ProQuake available, you can open the Code::Blocks .cbp project file and poke around there. Actually to get it to conpile all you'd have to do is press CTRL-F9. Even in Linux provided that the required development library was installed.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Feared » Fri Dec 10, 2010 2:56 am

I'll definitely poke around with Code::Blocks. I have zero experience with working out side of Windows. I can't afford an OS X system (except for a mini but that doesn't interest me in one bit) and Linux (Ubuntu) has pissed me off to no end with video drivers and the fact that I've never really sat down and tried programming on Linux. Seem'd too unintuitive and time consuming. I'll have to tinker around with everything, but for right now I am focused on Windows, maybe once I get use to CB i'll give Linux another shot. If I do though it'll be on Arch.

I'll have to mess with Code::Blocks for a while. But yes I was trying to create a new project file from scratch with CB. It's automatically sorting header files from cpp files for me. I don't like that, I'll have to keep messing with it. Visual Studio has definitely held my hand for too long, I kind of liked it like that, though. :)

Anyways, thanks for taking the time to explain this out of your busy schedule of ProQuake programmin'
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby Sajt » Fri Dec 10, 2010 4:27 am

One thing that sucks about Visual Studio (all versions) is that to configure your build at all you go into an infinite amount of menus with an infinite amount of options, 99% of which are irrelevant to you. (Wait... 99% of infinity? Nevermind...) It's all GUI-based, so if you want to do something custom, it's either impossible or extremely convoluted (and probably requires one of those "for dummies" books...). With a makefile it can be very simple. It's the same thing with Microsoft Word vs. HTML with CSS... the latter is SO much simpler, gives less headaches yet is much more powerful. MSVC2010 makes it a tiny bit better by bolding setting that differ from the default/inherited settings.

Now if only makefiles WERE simple. I have no idea what I'm doing when it comes to them. And it doesn't help that whenever you look at DarkPlaces or pretty much any other legitimate project, their makefiles are like 50KB...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby revelator » Fri Dec 10, 2010 5:04 am

realm uses codeblocks also ahem ;).

and you can actually import your visual studio files right into it.

there are a few caveats when doing that though i will list the most common.

the assembler files get imported but if you use mingw then as.exe "gnu assembler" will
throw an error (yep even if you run as directly on them which is imo strange as heck as there supposed to be old unix gas style assembler files). the fix is turning of compiling the assembler files and just use the C code for now . look in quakedef.h for the i386 define and turn it the hell off :lol:

the importer does a quite good job otherwise but a few precompiler variables gets passed as oldstyle gcc ones like -mcpu=pentium (deprecated) change it to -mtune=pentium or just skip it. the gcc which comes with codeblocks is fairly recent and does quite a good job handling that itself.

besides those small annoyances recent gcc actually compiles pretty fast.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby Feared » Fri Dec 10, 2010 6:06 am

Sajt wrote:One thing that sucks about Visual Studio (all versions) is that to configure your build at all you go into an infinite amount of menus with an infinite amount of options, 99% of which are irrelevant to you. (Wait... 99% of infinity? Nevermind...) It's all GUI-based, so if you want to do something custom, it's either impossible or extremely convoluted (and probably requires one of those "for dummies" books...). With a makefile it can be very simple. It's the same thing with Microsoft Word vs. HTML with CSS... the latter is SO much simpler, gives less headaches yet is much more powerful. MSVC2010 makes it a tiny bit better by bolding setting that differ from the default/inherited settings.

Now if only makefiles WERE simple. I have no idea what I'm doing when it comes to them. And it doesn't help that whenever you look at DarkPlaces or pretty much any other legitimate project, their makefiles are like 50KB...

I like the project menu's myself. I don't tinker with them a whole lot, though. I don't know why you're in so many menus, I'm only in one window in my projects settings... I also don't get why you're comparing shitty Word with Visual Studio. Don't do that. :)

reckless wrote:and you can actually import your visual studio files right into it.

Did not know this, neat. Going to have to try this. ;)
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby goldenboy » Fri Dec 10, 2010 8:05 am

User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby mh » Fri Dec 10, 2010 11:27 am

I like using an IDE. The convenience of having all tools needed to write code, compile, debug and test rolled up together can't be beaten for me.

It's quite cool that Code::Blocks exists, but it's never going to be my tool of choice. I've said before that I believe a really really good debugger is the most valuable tool you can have, and the debugger in MSVC is just the best there is, hands down.

Of course that's the debugger, not the IDE itself, and Code::Blocks can be configured to use the MS tools too, but it just feels more natural to work in MSVC.

You can resolve 99% of intellisense problems by just closing the Class View window. ;)

The auto-hiding windows are awesome. Extra screen real estate when you need it. Why does no other IDE do this?

I currently prefer 2008 and have no speed issues with it at all (8 cores helps I would assume). 2010 is great but there's some wonkiness in it (oddly enough, Find turned out to be the biggest problem for me). I think it needs a service pack before I'd seriously consider switching to it. Having a 1 Gbit net connection in work means that download times are really a non-issue for me too. :D
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby frag.machine » Fri Dec 10, 2010 11:52 am

About the VS 2010 IntelliSense slugshiness: I found out that installing something called "Windows Automation API 3.0" (I'm running Windows XP, it's not required for Vista/Windows 7) helped a bit. Still, it's slower than Eclipse autocomplete or even VS 2008, and very, very intrusive and annoying (it must be rewrote by the guys whom created the infamous Word Clippy).

Also, I'm getting problems with the buggy window refresh (sometimes the code window is simply not drawn, and you have to minimize and restore the whole IDE to fix it - :o ). I am glad I won't have to deal with this... thing... for much long now. :P
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby mankrip » Fri Dec 10, 2010 2:35 pm

mh wrote:The auto-hiding windows are awesome. Extra screen real estate when you need it. Why does no other IDE do this?

Auto-hiding panels are awesome indeed. JCreator does this, but it's for Java.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
User avatar
mankrip
 
Posts: 915
Joined: Fri Jul 04, 2008 3:02 am

Postby dreadlorde » Sat Dec 11, 2010 1:05 am

pfft, who uses an ide anymore? What is it, 1996?

:wink:
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Previous

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest