Wikipedia:Reference desk/Archives/Computing/2007 September 15
Computing desk | ||
---|---|---|
< September 14 | << Aug | September | Oct >> | September 16 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
September 15
editMicrophone
editCould someone recommend to me a high quality PC microphone? Preferably a headset. BeefJeaunt 00:37, 15 September 2007 (UTC)
I prefer USB headsets to traditional headsets unless you have a high quality microphone and a great great sound card. The answer depends on what you want to do with your microphone.
I will leave it to other wikipedians to give you brand names and product id numbers. Good luck. --Do not click me! 01:04, 15 September 2007 (UTC)
The Samson C01U is a great Large Diaphram USB mic, but I assumed this is for more than just speaking/recording?
Firefox image background
editI'm using Firefox 1.5. I'd like it so that when I'm viewing an image (by itself, not on a webpage) the background color changes to a different color like grey. This is to help me discern borders of bright images and also to display transparency with greater impact. So, I want to change the background color of images without having to change the default white background color of webpages. Sorry if its confusing..aznshorty67 01:35, 15 September 2007 (UTC)
- I've come up with something which isn't ideal but might be good enough. First install the Stylish extension from here. Once you've restarted Firefox, click the Stylish icon in the bottom-right and go to Write Style > Blank Style. Type 'Image border and background' into Description and copy and paste this into the large text box:
@namespace url(http://www.w3.org/1999/xhtml); img { background-color: #666 !important; border: 1px solid #222 !important; }
- ...and click Save. That'll add a grey border and background to all images on all pages (the not-ideal bit), but it will also add them when you view an image by itself. You can turn it on and off by clicking the Stylish icon, going to Global Styles and clicking 'Image border and background' - so you can keep it off when you're browsing and turn it on when you're viewing an image. — Matt Eason (Talk • Contribs) 10:35, 15 September 2007 (UTC)
- Hmm, is there a way to have it only do it on images? Such as adding a wildcard *.gif or something (I don't know much about coding). aznshorty67 21:10, 17 September 2007 (UTC)
Hardware problem
editI have just bought new GeForce 7600 GS from ebay.com (it was factory sealed, as i requested). I installed it and started my LOTRO. Everything worked perfectly well first, say, 5 mins and then i started to get weird flashing interruptions. It looks like when you change resolution and screen goes black for about second or two, than changes to lighter shade of black for 2 more seconds, than back to normal. And in about 5-10 secs same thing again. I have done some research on Google, absolute ZERO. No reports of even similar error, let alone fix. Through my tests i found following:
- It happens only when complex 3D games are running, not when you are browsing or something else.
-It happens on ALL games (tested on LOTRO, Lost Planet, F.E.A.R. Matrix)
-I found that "flashing" reduces when i play on lower resolutions, sometimes even stops completely when reducing resolution on F.E.A.R.
-I got 2 accounts on my XP and for brief period of 2 days, when i played on mine account, flashing completely stopped, but when i switch on my familie's account and try playing there it appears again. I didn't touch anything and it started to appear on my account again.
-No application, including drivers, report any error, like it never happened, witch might point to monitor as cause of problem, yet monitor worked perfectly with former integrated graphics on motherboard.
Here are my specs
P4 3.0 ATI Radeon XPRESS 200 motherboard with onboard graphic, PCI-E 16x (card connected on it currently). 2 X 512 RAM New 2 weeks old PSU 400 Watt Some generic "polyview" 19 inch LCD monitor Latest DX9 Latest ForceWare drivers ver. 162.18 downloaded from http://www.nvidia.com/object/winxp_2k_162.18.html
I think thats what you need to know, if there is anything else, ill be more than happy to provide additional info.
I asked same question on nVidia forum, no replies, i have no idea where else to turn for help. I know this question might not be appropriate for here, you are not technical support, in which case please delete it.
Please, any help, even if you don't know what causes it but have some ideas or hints, please write it down...
Thank you in advance... Nighthawk001 04:21, 15 September 2007 (UTC)
- It sounds like a heat issue. Verify that the fan is spinning, and that the heat sinks are firmly attached to the chips. --Mdwyer 21:25, 15 September 2007 (UTC)
- Fan is spinning, when browsing temperature is around 60C and when i run LOTRO on highest graphical settings with all shadows, transparency and 4x antialiasing it hangs around 68C sometimes dropping as low as 63 and rising till 71. I believe thats normal operational temperature. Also system fan reports 31889 RPM, nForce reports 675RPM and Aux2 reports 18 RPM (not sure where this fans are, im only copying what program says).
Nighthawk001 07:02, 16 September 2007 (UTC)
- It somewhat sounds like an incompatibility between your graphics card and monitor. You might want to check the connectors at both ends of the cable for any signs of trouble (bent pins, for example). If you have another cable available, try that out and see if it helps. If you have another monitor, try that and see if it helps. StuRat 18:51, 18 September 2007 (UTC)
Firefox Find function
editWhen I look through the ref desk pages I search for posts Ive participated in by searching for my name. But when I do that, the screen 'stops' with the found item (my signature) at the bottom, so every time I have to scroll down to see if there have been any follow-ups to my post. Is there a way to make Firefox show my signature (or whatever I'm searching for) in the middle of the screen? DirkvdM 04:39, 15 September 2007 (UTC)
- Ctrl+G or Next? --antilivedT | C | G 06:52, 15 September 2007 (UTC)
- Click Find Next. Djmckee1 - Talk-Sign 15:32, 15 September 2007 (UTC)
I suppose I didn't state the problem clearly enough. When I search for the next item (my name), be it with ^G or by clicking 'next' or 'enter', my signature (the search item) appears at the bottom, so I don't see if there has been a follow-up until I scroll down. No big deal, but somewhat irritating if I have to do it again and again when looking through the ref desk. I used to use a browser which showed the page with the search item in the middle, just can't remember which one. I believe it was Mozilla, which has the same origin as Firefox, so I suppose it should be possible to make behave in the same manner. DirkvdM 06:52, 16 September 2007 (UTC)
- No, but a workaround: start at the bottom of the page and do a "find previous" or "Control-Shift-G". --Sean 12:47, 16 September 2007 (UTC)
- Yeah, I thought of that too, but then it appears at the top of the page, as a result of which I can't read my own posting or the ones before it, so if there is a reaction I still have to scroll to see what it's about again. Better, but also for other reasons and purposes I prefer having the found word in the middle of the page. DirkvdM 18:53, 16 September 2007 (UTC)
- I switched to Opera partially due to this issue. Another problem was that I would start to type a search term, but it would search for the part I had already typed, not waiting for me to finish. This would cause it to jump to some random point in the page. Then, when it finally let me finish typing, it would find the next occurrence after that random point, not after my starting point. The straw that broke the camel's back was that changing the display scale causes Firefox to display gibberish. Now, if only Opera didn't feel the need to abort several times a day, I'd be a happy camper. StuRat 18:22, 18 September 2007 (UTC)
HTML and the line break?
editI'm trying a new idea where i have multiple lines displayed as a tooltip in an HTML document using the "Title" tag. Here is what ive written:
<a title="!YunaGames   A command to list available games.">Game Menu.</a>
... believe it or not this actually works! However, i cant use <br>, probably because of the quotes? you can see that i put in a non breaking space character in there..... that seems to work fine.... but is there a way to tell the browser to make a new line using the same & character? im sort of novice, and i looked in wikipedia under line break with no results, i also tried &crlf with no result.
Another idea is, i can try it without quotes, but then it seems to only show up to the > in <br>.... and then the rest is displayed as part of the text afterwards ("Game Menu.")
Any ideas? Thanks.
137.81.112.209 04:40, 15 September 2007 (UTC)
- See here. In short: no, there's no reliable, cross-browser way to do it. Apparently a carriage return will work in IE but not Firefox or other Gecko browsers. I would just use a hyphen or dash (eg "!Yuna Games - A command to list available games."). By the way, HTML entities require a semi-colon after them, so it's , not   — Matt Eason (Talk • Contribs) 10:13, 15 September 2007 (UTC)
- The & code for carriage returns is — that's probably as good as you'll get. --24.147.86.187 12:25, 15 September 2007 (UTC)
bipedal locomotion
editAre there any computer games/game engines that can/do use a physics type model of bipedal locmotion/walking for the in game character(s).
Are there any resources on modelling bipedal locomotion?87.102.47.225 09:12, 15 September 2007 (UTC)
- The old MechWarrior games had at least a simple model of it: the height of the vantage point depended on where you were during a step, and hit detection included the positions of the 'Mech's legs. In some of them (not the original MechWarrior 2, but in its sequel Mercenaries, for instance), a 'Mech with one leg would fall over realistically. --Tardis 15:36, 17 September 2007 (UTC)
Wikipedia in other languages
editCould someone give me a link to the website that searches "all" Wikipedias for a certain word, i.e. you type in a word, and it lists all language WPs that have an entry, and if they have interwiki links. Thanks --Montchav 10:06, 15 September 2007 (UTC)
- You could use a search engine eg google and type "(word) wikipedia" - that will work.87.102.47.225 10:22, 15 September 2007 (UTC)
- Or simply "word site:wikipedia.org" --antilivedT | C | G 10:32, 15 September 2007 (UTC)
- If you only want to find pages with that word in the article title, you can use inurl:word site:wikipedia.org — Matt Eason (Talk • Contribs) 10:39, 15 September 2007 (UTC)
- The page I was looking for is http://vs.aka-online.de/globalwpsearch/ --Montchav 10:01, 23 September 2007 (UTC)
- If you only want to find pages with that word in the article title, you can use inurl:word site:wikipedia.org — Matt Eason (Talk • Contribs) 10:39, 15 September 2007 (UTC)
- Or simply "word site:wikipedia.org" --antilivedT | C | G 10:32, 15 September 2007 (UTC)
PDF Files
editDoes anyone how to convert a PDF file on Windows Vista to Microsft Word 2007? --Writer Cartoonist 12:06, 15 September 2007 (UTC)
- There is no straightforward or simple way to convert PDF files to Word files. They are totally different types of files, and PDF is meant to be a format that is very easy to convert into but pretty tough to convert out of.
- If the PDF is simply text, you can select all, copy, and paste it into Word with some success usually. It if is very complicated, you'll need to extract the various graphical and textual elements separately and re-create them in Word. If it is a scanned document (a document image), then you can try copying and pasting the text if OCR has been run on it, but it is likely to be buggy.
- There are PDF-to-DOC converters for sale on the web; I would frankly distrust them and just do it myself. --24.147.86.187 12:22, 15 September 2007 (UTC)
Could I ask you if you mean convert to or convert from a PDF file? Converting to a pdf is pretty simple. (Go to the office button, click save as and then publish) And why would you want to convert from a PDF file? A PDF is forever! --Do not click me! 14:45, 15 September 2007 (UTC) --Do not click me! 14:44, 15 September 2007 (UTC)--Do not click me! 14:45, 15 September 2007 (UTC)
- I think it is pretty clear he wants to convert from a PDF to DOC. There are reasons one might want this — someone sent you a document as a PDF, you'd like to edit it — but as I said, it's not easy to do, and intentionally so. --24.147.86.187 15:07, 15 September 2007 (UTC)
A walk along the Wikipedia highway brought me to [1] aka Pstoedit. I have never used this software but could you look at it to see if it is what you need? Best of luck! --Do not click me! 00:46, 16 September 2007 (UTC) Do not click me! ~~ ~
Also my personal opinion, please avoid Microsoft Office 2007 file formats (docx, xlsx, ... etc) until it is widely accepted unless absolutely necessary. Thanks. --Do not click me! 00:49, 16 September 2007 (UTC)
- Or better yet, use OpenDocument! --antilivedT | C | G 02:44, 16 September 2007 (UTC)
- And for some more pov, this is a main reason pdfs are such a bad idea. When I mention to this to others, they either totally agree or point out that not being able to do anything with a pdf apart from reading it is actually an advantage because it stops people from 'corrupting' files or something. Which is a load of bull because you can alter a pdf file with a pdf writer (even if we don't have an article on it yet). Except that you first have to buy one. And there's the trick - get people addicted to pdfs through a free reader and then when you've conquered the market go "hey, if you want to do anything with them you'll have to buy the reader". And I'm baffled that people are actually falling for this. The only thing pdfs are good for is printing - create your text file with whatever editor and format you like and then when you want to print it, save a copy as pdf, print it, delete the pdf-copy and resume working with whatever other format you were using. May I recommend html - that's a truly universal standard (for reading). Just a shame that there are so few good WYSIWYG editors, such as Seamonkey Composer. However, most word processors will convert to html - you just get very ugly code and overly big files, which goes against one of the purposes of html (small downloads). DirkvdM 07:07, 16 September 2007 (UTC)
- Not to mention Adobe Reader is a piece of bloated crap. Click a .pdf in your browser, and it'll take 30 seconds to boot, then ask you if you want to do a bunch of updates, then continue taking massive amounts of CPU time and RAM. So glad I found an alternative. -Wooty [Woot?] [Spam! Spam! Wonderful spam!] 09:26, 16 September 2007 (UTC)
- Adobe Reader? Hah! Have you ever had the real adobe product, Acrobat 8? The installation is a massive 1.1GB- and it backs up the entire install DVD, which is required for updating! --frotht 18:52, 16 September 2007 (UTC)
- PDF has been reverse engineered pretty well though right? If adobe tries to lock it down there are always free alternatives, at least for already-created PDFs --frotht 18:52, 16 September 2007 (UTC)
- PDFs do keep files from getting corrupted as they move from machine to machine, which is important if you care about pagination in Word (which can easily change on different machines) or precise appearances of images and text using desktop publishing programs. They can make them uneditable by users (if you set all sorts of nasty passwords), but that's not really their advantage (passwords can be by-passed easily if the reader software does not pay attention to them—many early versions of PDF-reading for OS X, like ColorSync Utility, did not pay attention to the password flags, and let you override them). So they are useful for distribution of static files, and sometimes are a more useful format than original files if you have no plans to edit them (I often convert Word files to PDFs if I just plan to use them as something to search, because Preview and Reader are a lot faster at searching, and more flexible, than Word is itself—better of two evils, no?).
- Unfortunately PDF is a format which is very easy to write to, but very hard to read. So you can find a billion free writers out there and almost no free readers by comparison (most free readers are based on the same xpdf code base written ages ago now).
- Personally I think a really wonderful PDF renaissance will come when PDF reading APIs are more easily available to programmers and in simpler languages — I can imagine a dozen ways to better use PDFs than can currently be done (important to me, as I am an academic who deals with tons of PDFs via JSTOR and the like), but are out of my ability to implement because the PDF format is such a bear. --24.147.86.187 13:25, 16 September 2007 (UTC)
- Useful? I used to wonder why pdfs have to be downloaded twice. First I download the file and then when I view it, the separate pages have to be downloaded again. Until I relaised that wasn't the case - they were already there, in the file on my computer, it's just that reading the file was INCREDIBLY SLOOOOOOOOOOOOOW. Loading a page from my hd takes as long as loading a sizeable photograph into an image viewer. And that's for a simple text file. Unbelievable!
- As for the original file remaining intact, well duh! We've got Internet these days. You want something to remain uncorrupted and yet visible to others, well just put it on your site and spread the address around in stead of the file. If you offer it as a pdf on your site, then you get the horrible slowness and size that puts an unnecessary load on the Internet and people can still corrupt it. Not easily, but it isn't difficult either. If you present it on your site as a normal html file, then people would have to hack your site to corrupt the file, which is an entirely different ball game. DirkvdM 06:12, 17 September 2007 (UTC)
- Well, maybe we can come to an agreement if we say that PDFs are often misused, but when properly used they are a useful format. And don't confuse the format with the reader: Acrobat Reader is slow, but not all PDF readers are. And a poorly made PDF (like one created by Word) is going to be a lot slower than a well-made one. And there are many types of documents that could not be properly distributed as HTML files, as it would not preserve necessary formatting (HTML rendering changes based on operating system, browser, and individual user settings — great for web pages, bad for many other types of documents). In any case, if there were easier PDF reading APIs out there then it would be easy for new, faster reader programs to emerge. At the moment it is an open format but if you want to do much with it you either have to sludge through some very tough coding or you have to pay BIG bucks to get limited access to commercial APIs — not a good situation for such a commonly used format. --24.147.86.187 15:44, 17 September 2007 (UTC)
- I have worked on lots of different computers with different readers installed and they were all excruciatingly slow. The fact that many are so slow points at a problem with the format, whatever the cause may be. In comparison, ever encountered a browser that was anywhere near that slow (even if the html file is created with msWord, as is often the case)? If pdfs are so easily misused then there is something inherently wrong with them. Yes pdfs are good for printing. That's it. And they're absolutely the worst choice for putting info on a website because they clog up the Internet with their humongous sizes. There should be a law against offering them on websites. :)
- As for html files not being wysiwyg (rendering differently on different browsers), that's an option of html you don't need to use. It's the default (for good reasons), so many assume it's the only option, but it doesn't have to be like that. Many sites fix the width of the page (which I strongly dislike because it wastes most of my screen size). I'm not entirely sure, but can't html files be just as fixed as pdfs by simply specifying everything - font type and font size and possibly even putting it all in a (one-cell) table with fixed with? That thought just entered my mind and I might play with that someday. Of course the user can override those settings in the browser, but if they don't then an html file could be just as good for printing purposes. That's the beauty of html: you can go into the code and specify everything there, down to the last detail. Ever tried opening a pdf file in a text editor? Totally useless. DirkvdM 18:19, 17 September 2007 (UTC)
- I think the reason why PDFs often behave like large photos is that they often are large photos. Many I've viewed appear to be scanned documents left as bitmaps (no OCR used on them). StuRat 18:37, 18 September 2007 (UTC)
- Yeah, I've seen that misuse too, but most of the time that's not the cause of the slowness. DirkvdM 05:44, 20 September 2007 (UTC)
WEBSITE help: it suddenly stopped working
editHello, I am new to websites, but to save some money, I used frontpage to design my page and get a free host, newsit.es, to host it. For a while, my .com domain worked and I was happy with my website. Then suddenly, I checked my page on internet explorer and it says the server cannot be found. I know that newsit.es is working because the same page I made for my .com domain is displayed on username.newsit.es . I tried updating the page with frontpage and it still hasn't showed up on the net. Also, I bought the domain about 2 months ago and paid for a year, so I am confident that I still own it. Any ideas would be greatly appreciated,
Thanks, Robert —Preceding unsigned comment added by 71.56.231.40 (talk) 14:21, 15 September 2007 (UTC)
Have you checked the nameservers or URL forwarding settings, is the site still on the free url? Djmckee1 - Talk-Sign 15:36, 15 September 2007 (UTC)
yes, i've checked the nameservers and URL forwarding settigns and those haven't changed. The free url still works too, but not the domain —Preceding unsigned comment added by 71.56.231.40 (talk) 16:04, 15 September 2007 (UTC)
There are so many things that can cause that page to be shown when you visit a website. Whenever i look at my website and discover that it is showing a 'page not found', I frantically do the the following:
1. Check google.com to see if that's working - hence my internet connection is likely to be working. 2. Ping it to check the website's connection to the net: e.g: on Windows XP > START > All Programs > Accessories > Command Prompt then, type the following on the commnad line: ping examplewebsitename.com (Where examplewebsitename.com is the name of your site) 3. Phone a friend who uses a different internet connection service and ask them to see if they can see the site. This is probably not useful, but in general a good thing to know.
I think they are having a problem with theit nameservers cos they are being taken over by a different company. My websites are exactly the same...
Auto tabbing in MS Word
editWhile typing in Word, I have noticed that it automatically inserts a paragraph tab every time I press enter for a new paragraph. I can see why this could be handy for some people, as I almost invariably want a tab there. However, I automatically hit tab after enter, so I end up with two tabs. How do I turn off this feature? Thanks. 80.229.160.127 16:25, 15 September 2007 (UTC)
- Just go to the auto format under the Format menu and uncheck "Spaces at beginning of paragraph with first-line indent". Unless you're using 2007, then I'm not sure if its in that exact same spot. --Wirbelwindヴィルヴェルヴィント (talk) 16:41, 15 September 2007 (UTC)
- I'm using 2003, but there is no option for "spaces etc" in that dialogue, it ends after the Internet hyperlink option. Is there a way of making it appear in the dialogue? 80.229.160.127 09:41, 16 September 2007 (UTC)
- Along the top of the page there ought to be a ruler, with a little arrow thingie on it, that's exactly one tab-stop in. Move it out to the bottom arrow at the edge of the page. Kuronue | Talk 02:27, 20 September 2007 (UTC)
Connecting eTrex Summit GPS receiver with a PC
editI recently bought a GPS Receiver(Garmin eTrex Summit).It came with a cable (RS-232) for connecting it with a PC.I connected with that cable but the computer does not detect it. So I could not work with this device.Please help.Thank You —Preceding unsigned comment added by 202.70.67.182 (talk) 16:56, 15 September 2007 (UTC)
- Windows generally doesn't detect devices hooked up to serial ports. In theory, you'll need to have some form of GPS software, and either instruct it to look at a specific port, or it may scan the ports at that time. --Mdwyer 21:22, 15 September 2007 (UTC)
Easiest database software
editWhat's the easiest free database software for single-user offline portable relationals on Kubuntu? I tried to use OpenOffice.org Base, but discovered a critical bug in the Ubuntu-package version of the program, which makes me want to look elsewhere. NeonMerlin 19:36, 15 September 2007 (UTC)
What was the bug? There might be a workaround. —Preceding unsigned comment added by 71.195.124.101 (talk) 00:24, 16 September 2007 (UTC)
- There might be, but unless OOo Base has improved a LOT since I last tried to use it, it really isn't at a stage where it is an efficient program to use. Last time I tried to use it, it would barely run. (I say this as a seasoned Access programmer, which is what it is clearly trying to emulate.) --24.147.86.187 01:52, 16 September 2007 (UTC)
- The bug is #72262. There is a workaround, but it involves uninstalling the package version of the entire suite and replacing it with one manually built from source. I'm not prepared to do this; besides the inherent hassle and complications of a build from source, it would mean no automatic detection of updates, and improper handling of dependencies should I ever install a package that depends on OOo. In short, I'm pretty sure it would more than negate any ease-of-use advantages Base has over the competition. I tell you, Linux would be virtually impossible to use if it weren't for the package system. NeonMerlin 01:57, 16 September 2007 (UTC)
- There is checkinstall which will generate a deb package and you can maintain it through synaptics. --antilivedT | C | G 09:27, 16 September 2007 (UTC)
- It's still complicated enough that I'd like to explore the alternatives first. NeonMerlin 16:09, 16 September 2007 (UTC)
Empty users' recycle bins
editHi. I use Windows XP. Many users on the computer put large files in the recycle bin but do not empty it. As a result the drive is almost full. Is there a way for an administrator to empty other users' recycle bins? --141.156.250.167 21:01, 15 September 2007 (UTC)
- I doubt it, though it should be possible for an administrator to set a maximum size of a recycle bin. --24.147.86.187 21:46, 15 September 2007 (UTC)
- Certainly, an administrator should be able to delete information from the recycle bin. I can't do it from here (I'm on a Mac), but I'm pretty sure there's a hidden folder under each user's directory, for which an administrator could go in and manually clean it out for each user. Try checking out this for tips on resizing the recycle bin. I hope this helps. The Evil Spartan 00:03, 16 September 2007 (UTC)
- Hmm, you're right, I forgot about how it was stored. Yeah, it should be able to be located and emptied in that way. --24.147.86.187 00:29, 16 September 2007 (UTC)
- Also on XP pro it should be possible to limit other users' hard drive quotas to, say, a vicious 10MB :) No telling what will happen if they're administrators too though. If you own the computer (not exactly sure how it affects the situation legally if it's someone else's; IANAL) you can of course just log in to their account and empty their recycle bin the normal way. This is trivial if you have administrator access anyway. Also trivial if you have physical access to the machine and it's a local login. --frotht 18:58, 16 September 2007 (UTC)
- One warning, if user's Recycle Bins have remained unmolested until now, they may very well have developed bad habits, like "deleting" things they really want to keep, just to get them out of their way for the moment (knowing they could get them back from the Bin whenever needed). Thus, when you start emptying their Bins you may end up deleting important data. Therefore, you should send out many warnings before you start doing this.
- Then there is also the issue of people just accidentally deleting things. They won't necessarily immediately recognize the mistake, but might not notice until they use that program again and their data is missing, when they then go look in the Bin for it. I'd suggest that you only delete data from the Bin that is quite old, say 90 days, to prevent this. StuRat 17:56, 18 September 2007 (UTC)
Multifile linking in C++
editHi all:
I would like to create a simple program in C++ with two files. In one file I would like to place class, together with its functions (Java style). In the other file I would like to place the main(). Can anyone give me a short set of steps to follow? (something like: 1) create main.cpp with your main, 2) create myclass.cpp with your class, 3) create and object with "gcc -c myclass.cpp", 4) compile main.cpp with "gcc -c main.cpp", 5) link with "gcc main.cpp myclass.cpp")... Thanks a lot people! --Waldsen 22:47, 15 September 2007 (UTC)
- Um, that's exactly how you do it. -Wooty [Woot?] [Spam! Spam! Wonderful spam!] 23:06, 15 September 2007 (UTC)
- Hehe, I think something is missing though. Maybe an include statement or a header file, but I'm not sure how those would look. --Waldsen 23:54, 15 September 2007 (UTC)
- Yeah. Often (traditionally?) the class definitions and similar are placed in a "header file" (traditionally .h instead of .cpp, but can be anything). This header file must be "include"ed in main.cpp do that the defs are visible at compile time. So:
- create myclass.h,
- create main.cpp, adding the line #include "myclass.h" after your other includes,
- compile and link with "gcc main.cpp", (default executable name is a.out)
- edit the source file(s) to fix bugs
- goto 1 :-)
- Saintrain 00:02, 16 September 2007 (UTC)
- Yeah. Often (traditionally?) the class definitions and similar are placed in a "header file" (traditionally .h instead of .cpp, but can be anything). This header file must be "include"ed in main.cpp do that the defs are visible at compile time. So:
- In the myheader.h file, I added just one line: "class myclass;". In main.cpp and in myclass.cpp, I added the line "include <myheader.h>" When I compiled, I got the following error: "main.cpp:2:22: error: myheader.h: No such file or directory". Is the compiler looking in the wrong directory or something? --Waldsen 00:15, 16 September 2007 (UTC)
- I fixed it! Turns out the include line is "include "myheader.h"". Thanks for the help! --Waldsen 00:18, 16 September 2007 (UTC)
Mmm... New problem: I have three files:
main.cpp
#include <iostream> #include "myheader.h"
using namespace std;
int main() { cout << "Hello, World!\n";
Number MyNum;
MyNum.set(7);
cout << "Num: " << MyNum.get();
cout << "\n\n";
return 0; }
myheader.h
class Number;
Number.cpp
- include "myheader.h"
class Number { int n;
public: int get(); void set(int num); };
int Number::get() { return n; }
void Number::set(int num) { n = num; }
The I did the following: "g++ main.cpp", and I got the following error: "main.cpp:10: error: aggregate ‘Number MyNum’ has incomplete type and cannot be defined"
Any thoughts? (p.s. I don't know how to format wikicode so the cpp code looks nice) --Waldsen 00:25, 16 September 2007 (UTC)
- Move the class definition of Number to "Number.h" and keep only the function definitions in "Number.cpp". GCC cannot compile your main file, because the mere declaration of Number as a class does not tell it how much space needs to be reserved in the stackframe of main to store an instance of Number. —Preceding unsigned comment added by 84.187.34.84 (talk) 00:58, 16 September 2007 (UTC)