Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - MinGW compliation options | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7775/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Another thread, this time regarding MinGW and gcc... I've noticed two minor annoyances that keep coming up. 1) If I compile with the -mconsole flag, a console window is created even if it's never used. If I omit the flag, no console window appears, but anything that should be printed to the console doesn't show up even when running the program from one. What I want to do is not create a console window, but if the program is executed from one, redirect any printf()s to it. (Or don't create a console window when the program starts, but be able to make one from within the program.) 2) The __FILE__ keyword includes the entire path to the source file, drive letter and all. Is it possible to just give the filename and not the path? Would I need to resort to copying all the files to gcc's directory before compiling them, or is there a simpler option? |
|||
OmnipotentEntity Micro-Goomba Level: 4 Posts: 6/10 EXP: 162 For next: 117 Since: 10-07-05 From: Oh Noes, Penguins! Since last post: 11 days Last activity: 2 days |
| ||
Originally posted by Santa Claus I'm pretty sure that the second is impossible to do using the native Windows console. Because it'll have to be the child of the console in order to print to one (well, I'm you *could* do some *really* nasty hacking and spawn a cmd then manipulate it's memory, but if you try that in Windows I'm pretty sure that the OS will kill the process). You can however recode the program a bit to spawn a window that looks like a cmd and redirect all printf()s to that window. As for the first part about the flag, because of the above, I doubt there is a way to have a console spawn when you need it. I know you can do something fancy with the code and make it not visible until a printf() is called (for example the Windows version of MDCrack hides the console on startup), but I honestly have no idea where to start with that (but MDCrack is Open Source so you could try checking the source). I tried checking the gcc man pages, but I couldn't find a page for the MinGW version of gcc. And I'm sure you've already browsed through them. So I don't think there is a way to compile it under windows how you want without editting some code. Good Luck with that. -EDIT- A small bit of clarification, In my first paragraph I was referring to the second bit of the first question, not the second question. I have even less clue about the second question. (edited by OmnipotentEntity on 10-20-05 09:32 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7896/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I know it's possible to either hide the console or prevent it from being created, because I've seen programs which display it on command. I guess I might be able to do some sort of window manipulation to find the console and hide it, but I'm not entirely sure how well that would work if it's even possible. | |||
OmnipotentEntity Micro-Goomba Level: 4 Posts: 7/10 EXP: 162 For next: 117 Since: 10-07-05 From: Oh Noes, Penguins! Since last post: 11 days Last activity: 2 days |
| ||
Again, I do know that MDCrack hides it on startup, and they're Open Source, so perhaps you can look there for pointers. The impossibility I was referring to was doing it only using the compiler. | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 7930/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Alright, well I got it to work by finding any console window with the program's name (including .exe) in it and hiding it, then showing it when doing printf() (I use a wrapper function that does a few other things, so it wasn't exactly difficult to implement ). Of course, this won't work if future versions of Windows (or tweaks) stop the console windows from containing the program's full name or if the EXE is renamed... guess there's no better way? |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - MinGW compliation options | | | |