|
LockeNess Monster posted:The only thing missing is good code formatter and not freezing. So basically the things missing from it are 1) one of the main things you'd expect from any editor this side of Notepad, and 2) one of the main things you'd expect from any application this side of Windows 95. Also it boggles my mind that anyone would have a hard time figuring out Visual Studio. Avenging Dentist fucked around with this message at 02:40 on Mar 19, 2010 |
# ? Mar 19, 2010 02:37 |
|
|
# ? Jun 8, 2024 23:14 |
|
At least its not an overcomplicated confusing mess that is VS. Seriously I worked on some small projects in Windows and DevC++ and other than occasional freezing it was relatively pain free. Crazy RRRussian fucked around with this message at 02:42 on Mar 19, 2010 |
# ? Mar 19, 2010 02:40 |
|
LockeNess Monster posted:At least its not an overcomplicated confusing mess that is VS. How is VS confusing? You basically install it and press a couple buttons and start typing. Once you learn the build/run/debug shortcuts you don't even need to look at the menus 99% of the time. Of course, the real question then is why not pick something decent like Eclipse (ok, I'm being charitable here, but at least Eclipse doesn't usually crash), or emacs/vim? I mean seriously, a text editor that freezes is basically the worst possible editor to pick unless it just continually saves your work due to its own knowledge about how lovely it is.
|
# ? Mar 19, 2010 02:43 |
|
Avenging Dentist posted:How is VS confusing? You basically install it and press a couple buttons and start typing. Once you learn the build/run/debug shortcuts you don't even need to look at the menus 99% of the time. If I need to develop in C++ i code in linux (using gedit or Eclipse, I know I should probably learn vim or emacs). If I need to port it to Windows I get it to point where I can compile it using cl.exe or in DevC++ and continue writing actual code in linux. Crazy RRRussian fucked around with this message at 02:46 on Mar 19, 2010 |
# ? Mar 19, 2010 02:44 |
|
LockeNess Monster posted:If I need to develop in C++ i code in linux (using gedit or Eclipse, I know I should probably learn vim or emacs). If I need to port it to Windows I get it to point where I can compile it using cl.exe or in DevC++ and continue writing actual code in linux. Then why do you even have an IDE? Why not just cross-compile?
|
# ? Mar 19, 2010 02:49 |
|
Avenging Dentist posted:Then why do you even have an IDE? Why not just cross-compile? For syntax highlighting, code folding and code formatting? Also I occasionally use refactoring tool in Eclipse. Meh, I should probably pick up Visual Studio, but right now all of my C++ development needs are satisfied by using Eclipse in Ubuntu running in my VMWare.
|
# ? Mar 19, 2010 02:52 |
|
LockeNess Monster posted:For syntax highlighting, code folding and code formatting? Also I occasionally use refactoring tool in Eclipse. You don't need an IDE for the first 2, and real men don't write code that needs reformatting ;-). But why not use Eclipse on Windows too, if you like it?
|
# ? Mar 19, 2010 02:54 |
|
OddObserver posted:You don't need an IDE for the first 2, and real men don't write code that needs reformatting ;-). But why not use Eclipse on Windows too, if you like it? Only use Eclipse for Java on Windows. Couldn't figure out how to use mingw with Eclipse on windows in 20 minute so gave up and stopped caring.
|
# ? Mar 19, 2010 02:58 |
|
LockeNess Monster posted:I don't really understand all the hate for DevC++. Sure it freezes occasionally, but it is a lot simpler and more straightforward to use and learn how to use than Visual Studio. It is pretty easy to set up C++ projects in it and have them compile and run fine. The only thing missing is good code formatter and not freezing. If you can't figure out how to use Visual Studio, then you have no business programming C++.
|
# ? Mar 19, 2010 03:05 |
|
floWenoL posted:If you can't figure out how to use Visual Studio, then you have no business programming C++.
|
# ? Mar 19, 2010 03:35 |
|
If you absolutely hate Visual Studio you can always try Code::Blocks. But really, just get used to Visual Studio.
|
# ? Mar 19, 2010 03:52 |
|
Also, Dev-C++ comes with GCC 3.4 and GDB 5.2, which are amazingly out of date. Like, 5 years out of date.
|
# ? Mar 19, 2010 05:10 |
|
I tried dev-c++ something like 5-6 years ago and it was a lovely crash-happy mess. Glad to hear that there are some things you can rely on! Also, it does something weird with GCC options or something because sometimes it just fails to compile code that the same GCC on commandline compiles with no problems.
|
# ? Mar 19, 2010 19:00 |
|
niteice posted:Also, Dev-C++ comes with GCC 3.4 and GDB 5.2, which are amazingly out of date. Like, 5 years out of date. Yeah, I posted some code here a while back and couldn't figure out why it simply wouldn't work and was told that what I had written shouldn't even be compiling - eventually people figured out it was because I was using dev-C++. Its old GCC and GDB really do hurt you in a lot of ways.
|
# ? Mar 20, 2010 23:22 |
|
I'm trying to do something extremely simple with OpenGL and every tutorial I can find on this is written way beyond my level of understanding and doesn't involve simple shapes. All I want to do is rotate a square (currently on the right side of the screen) around the center of its axis while moving it 40 units to the left until it hits a certain point. I can get it to move, but it's through using a very "hack"ish way of modifying the x-coordinates when I feel like transform might need to be used. Also please don't mind the name "rect" because it's a square and I'm a bit OCD and don't like to do what would be cosmetic changes until I actually have it semi-functional. code:
|
# ? Mar 21, 2010 00:24 |
|
Whilst farting I posted:I'm trying to do something extremely simple with OpenGL and every tutorial I can find on this is written way beyond my level of understanding and doesn't involve simple shapes. All I want to do is rotate a square (currently on the right side of the screen) around the center of its axis while moving it 40 units to the left until it hits a certain point. I can get it to move, but it's through using a very "hack"ish way of modifying the x-coordinates when I feel like transform might need to be used. Your problem is you are trying to move the rectangle by changing the statements within you glBegin/glEnd block. This will become a problem when your geometry is nontrival and you end up using display lists or vertex buffers. You instead want to use glTranslate and glRotate (or glMultMatrix once you know what you are doing) to transform the drawn shape. This code example assumes the matrix mode is GL_MODELVIEW. And FYI, my base for testing this code was NeHe Lesson 4. All you need to do is place this within the DrawGLScene(). code:
glTranslate is a simple transformation, it effectively moves the draw stuff from the last applied transform to a new location. glTranslate defines what x,y,z mean via the the rotation state, which is modified by glRotate. glRotate changes the orientation of the coordinate axis of the last applied transformation. glRotate takes 4 arguments. The first is simplest to understand, it is the amount to rotate about in degrees. The next three arguments define a vector to rotate about. In this example, it rotating about the z axis (ie unit vector [0,0,1]), which happens to be pointing towards the user's eye. However, if you had applied another rotation first, the z-axis of the rotation would be the new z-axis defined by that transformation. However no matter where the final z-axis points, it will be the normal of your rectangle, because the quad is defined in the x-y plane. litghost fucked around with this message at 01:45 on Mar 21, 2010 |
# ? Mar 21, 2010 01:34 |
|
If I have a void * ptr to some data is there a way to distinguish whether it points to mmaped data or malloced data? Will madvise work for this? There is also an int size that represents the number of allocated bytes.
functional fucked around with this message at 02:56 on Mar 21, 2010 |
# ? Mar 21, 2010 01:47 |
|
functional posted:If I have a void * ptr to some data is there a way to distinguish whether it points to mmaped data or malloced data? Will madvise work for this? There is also an int size that represents the number of allocated bytes. No. malloc might use mmap behind the scenes.
|
# ? Mar 21, 2010 02:55 |
|
ShoulderDaemon posted:No. malloc might use mmap behind the scenes. OK. You've pointed out that my question wasn't specific enough. What I actually want to do is safely munmap/free the data. On the manpage munmap is listed as having unspecified behavior when attempting to unmap data that was not originally mmapped. Is this actually true, or is munmap in practice more resilient than free()? The mapped data I am concerned about unmapping will always represent files on disk. (In some cases I might have control over whether malloc uses mmap. What might change in the above scenarios when this is the case?) functional fucked around with this message at 03:06 on Mar 21, 2010 |
# ? Mar 21, 2010 03:03 |
|
functional posted:Is this actually true, or is munmap in practice more resilient than free()? The mapped data I am concerned about unmapping will always represent files on disk. On at least some systems, brk is implemented behind the scenes as extending an anonymous mapping. If you were to munmap this, you could lose a whole segment of your current executable. On at least some other systems, calling munmap on memory that was not allocated by mmap hits uninitialized values in kernel space, and results in something being unmapped. There is no portable way to decide how a given pointer was allocated. You have to either track that yourself, or find some other way around your problem. If you don't care about portability, and you have the size stored separately, you could try poking the internals of your malloc implementation to see if it has an allocation for your address with the same size you think it should have, and use that to decide if you should free or munmap. But that's not exactly sane.
|
# ? Mar 21, 2010 03:22 |
|
litghost posted:Your problem is you are trying to move the rectangle by changing the statements within you glBegin/glEnd block. This will become a problem when your geometry is nontrival and you end up using display lists or vertex buffers. I tried running Nehe's program 4 and don't understand how it works - its points for the Quad are all 1, but the area is definitely much bigger than 1 pixel. It also does not move, just rotates. I also don't have a DrawGLScene function - my main contains a glutDisplayFunc(displayFunction), a keyboard function, a time, and a main loop and that's it. This is the content of the display function. code:
Here's what I'm trying and what I understand (I've removed all modifications to rectX1 and rectX2, and this is the entirety of rectMove()): code:
Thank you again to edit to add more info, I had been checking other websites on what those functions do and how the parameters interact and this was by far the most concise and easy to understand information. I really appreciate the effort.
|
# ? Mar 21, 2010 04:31 |
|
Whilst farting I posted:You should learn to read the man pages, see glTranslate, and glRotate. You also need to realize that the coordinates in OpenGL have no direct relations to pixels except in extremely specific situations, like an orthographic projection with the width and height equal to your view port size. See glOrth. Generally speaking OpenGL coordinates can be united based on physical units if you want (ft, in, m, etc.), or whatever you want. The projection matrix is how you get from model coordinates (your rectangle) to screen coordinates, kind of. I am simplifying this explaination, you can get more details here.
|
# ? Mar 21, 2010 04:45 |
|
I don't know if this is exactly the right place, but we don't have a real computer architecture thread for my question. What exactly is g++? I know that it is a compiler. But is it also a linker? Is it also a loader? I'm pretty sure that it is not a loader, but I think that it could be a loader. I am studying for a midterm in computer architecture 1 and this is a question that is coming up when reading through the "Translating and Starting a Program" chapter. I was also under the impression that loading and linking happened at the same time because linking needs to know the exact addresses. Does that mean that bash or the OS takes care of that when you actually type "./a.out"? Thanks for your help!
|
# ? Mar 21, 2010 16:15 |
|
sonic bed head posted:What exactly is g++? I know that it is a compiler. But is it also a linker? Is it also a loader? I'm pretty sure that it is not a loader, but I think that it could be a loader. I am studying for a midterm in computer architecture 1 and this is a question that is coming up when reading through the "Translating and Starting a Program" chapter. I was also under the impression that loading and linking happened at the same time because linking needs to know the exact addresses. Does that mean that bash or the OS takes care of that when you actually type "./a.out"? It compiles and links, but is not a loader. On linux "man ld.so" explains runtime linking and loading and "man exec" for what happens when you're asking your shell to run an executable.
|
# ? Mar 21, 2010 17:02 |
|
litghost posted:You should learn to read the man pages, see glTranslate, and glRotate. I understand how translation and rotation work, I think, now - I just don't understand why my code is not working. It'll be a lot easier for me to understand projection matrices though if I can get it moving besides manually changing the x coordinates of the quad. For instance, I don't get why this code works, from Red Book chapter 3: code:
code:
|
# ? Mar 21, 2010 19:25 |
|
Whilst farting I posted:You are going to need to post a compiling example for anyone to diagnose the problem further. Also, there is a dedicated thread for graphics questions over here, that you might want to move this question too.
|
# ? Mar 21, 2010 20:06 |
|
Whilst farting I posted:I understand how translation and rotation work, I think, now - I just don't understand why my code is not working. It'll be a lot easier for me to understand projection matrices though if I can get it moving besides manually changing the x coordinates of the quad. -0.75 is a very small amount for a GL rotation; that number is supposed to be in degrees (and see how the example code uses 72 there). A much larger number is needed for the image to noticeably change.
|
# ? Mar 21, 2010 20:18 |
|
Here's the full file: http://pastebin.ca/1848509 I'm trying to, upon hitting d a second time, get the square to launch to the left while rotating about its center. I can only get it to move to the left by manually subtracting from the x coordinates, which isn't translation and won't rotate anything. Removing rectX1 and rectX2 and replacing them with actual numbers does not change the outcome. I understand that it's a small amount of rotation, the number I had, but I can't get it to move at all - lots of great info has been posted and I hope I can learn from it once I can get the square moving and can play with some numbers a bit more. Whilst farting I fucked around with this message at 21:59 on Mar 21, 2010 |
# ? Mar 21, 2010 21:55 |
|
Hello CoC, I was wondering what the standard way of simulating mouse/keypress inputs would be under Linux (Ubuntu). Is there any Linux version of SendInput or SendMessage? Edit: NM, xdotool will work fine. Thank you, STOP SIGNING YOUR POSTS Somebody fucked around with this message at 18:34 on Mar 23, 2010 |
# ? Mar 21, 2010 23:01 |
|
covener posted:It compiles and links, but is not a loader. On linux "man ld.so" explains runtime linking and loading and "man exec" for what happens when you're asking your shell to run an executable. Thanks! I had no idea that there were separate programs that did this.
|
# ? Mar 21, 2010 23:41 |
|
Having a little problem with stuff going out of boundary of my array http://pastebin.com/SH2ExLqz It's a homework from my c class and it's supposed to place a Queen randomly and cross out(with x) its possible path. and after crossing out, it's supposed to continuously place queens till the board is filled out. I thought I kinda figured it out but I'm not sure how to limit the for loop so that i does not go out of the boundary. washow fucked around with this message at 05:43 on Mar 22, 2010 |
# ? Mar 22, 2010 04:55 |
|
What is the problem, specifically? Nobody is going to sit through a 10x10 n-queens solution to just watch it crash (and you're not being consistent with your usage of COL and ROW so I can't modify those values to have it just run on a smaller board). Did you at least run your program through gdb? edit: that said, your checkDiag function looks pretty fishy; I would highly recommend you start looking there. Dijkstracula fucked around with this message at 05:59 on Mar 22, 2010 |
# ? Mar 22, 2010 05:57 |
|
Uhh sorry about that. But what do you mean by my inconsistency with ROW and COL usage? I #defined it up top. Basically my problem is that diagonally, the Xs go over the boundary so it appears on the next line and stuff. Sometimes it works, and sometimes it just goes downright runtime error and I'm not sure how to make sure that Qs and Xs don't go over the boundaries E: Oh and am I doing checkNull wrong? Shouldn't it continuously run the program till there is no empty space? if I just leave it like line50 while (checkNull);, the program just hangs. . Xs appearing in weird spots ugh washow fucked around with this message at 06:20 on Mar 22, 2010 |
# ? Mar 22, 2010 06:13 |
|
OK, let's look at line 50 since you brought it up. Are you checking whether the return value from calling checkNull() is null, or are you checking whether checkNull is a null function pointer? if the latter, when would we ever break out of the do { ... } while( <non-zero value>); loop? Also, this is a problem that compiling with warnings on would have explained: g++ posted:lo1-189:~ ntaylor$ g++ -Wall foo.cpp edit: to answer your ROW/COL inconsistency question, look at line 85. I would would very closely at line 85, particularily if you're trying to track down where you might be walking off the end of an array. edit: also, you're using rand() to place the queens? Dijkstracula fucked around with this message at 06:36 on Mar 22, 2010 |
# ? Mar 22, 2010 06:23 |
|
Oh I see that I didn't call the function right. I'm trying to see if there's an empty space (null) in the array. So if there is a null, return false. And do while loop checks that bool and if it's false, run the program again E: I know line 85 is wrong and that 10 was just a placeholder. I can't figure it out how to set the condition so that it doesn't go over. Make it COL? And what's wrong with rand() placement washow fucked around with this message at 06:39 on Mar 22, 2010 |
# ? Mar 22, 2010 06:37 |
|
Tell you what, walk through a call to checkDiag() by hand. Take, for instance, i = j = 9. See how long it takes before you start writing to memory outside the array. You should be able to figure it out from there. What's wrong with rand() is that your program will run several orders of magnitude longer than it needs to. I mean, I haven't spent much time looking at your code but I would be surprised if it even works correctly. Dijkstracula fucked around with this message at 06:45 on Mar 22, 2010 |
# ? Mar 22, 2010 06:42 |
|
All I can figure out is that the z of i < z changes dynamically and I have no idea how to make z so that a[x+z] does not go outside of the boundary. Feeling so dumb right now
|
# ? Mar 22, 2010 06:52 |
|
gcc problem! I am trying to add a constructor overload that only gets chosen for string literals but not for const char* variables, so that those fire a deprecation warning. But apparently the "deprecated" attribute only works for regular constructors and function templates, but not for template constructors. The idea here is to make my class yell at people who hardcode the strings they instantiate it with, but not people who load them from the proper resource files. Any ideas? code:
foo.cpp: In function ‘int main()’: foo.cpp:20: warning: ‘B::B(const char*)’ is deprecated (declared at foo.cpp:11) foo.cpp:21: warning: ‘void f(const char (&)[N]) [with int N = 5]’ is deprecated (declared at foo.cpp:16) edit: gcc bugtracker has this listed and suggests a workaround, guess I should have checked there first. Vanadium fucked around with this message at 20:51 on Mar 23, 2010 |
# ? Mar 22, 2010 14:34 |
|
If you want them to stop doing it, why not just make it not compile?
|
# ? Mar 22, 2010 17:52 |
|
|
# ? Jun 8, 2024 23:14 |
|
Because I do not want to be responsible for figuring out how to fix the sites where it is currently used.
|
# ? Mar 22, 2010 19:34 |