• What do you need help with? Version 1
    5,001 replies, posted
Your analogy is bad, and you should [i]feel[/i] bad. </zoidberg>
I am having problems receiving some packets over UDP with boost::asio. This class: [url]https://github.com/Lalaland/Bullet/blob/networked/server/src/server.h[/url] is sending packets during the end of its large handler function in: [url]https://github.com/Lalaland/Bullet/blob/networked/server/src/serverNetwork.cpp[/url] line 184 to the gameHandler function from this class: [url]https://github.com/Lalaland/Bullet/blob/networked/client/src/client.h[/url] in this file: [url]https://github.com/Lalaland/Bullet/blob/networked/client/src/clientNetwork.cpp[/url] line 118 The packet I am trying to send is in here: [url]https://github.com/Lalaland/Bullet/blob/networked/network/network.h[/url] line 94 But that should not matter as it should output to standard input for any received packet. The output I get is this from the server, correctly showing the packets are sent: [URL=http://img836.imageshack.us/i/serverb.png/][IMG]http://img836.imageshack.us/img836/9539/serverb.png[/IMG][/URL] The output I get from the client shows that I called the async_recieve function, but does not show any packets received: [URL=http://img337.imageshack.us/i/client.png/][IMG]http://img337.imageshack.us/img337/6350/client.png[/IMG][/URL] All of my other packets got through. This is also the local loopback, so packet loss should be nonexistant.
Very quick question been googling for ages. Does Pascal support this kind of syntax in case statements? [code] case LastChar of 'A','B','C','1','0' : begin SmartA.Enabled := false; SmartB.Enabled := false; SmartC.Enabled := false; SmartTrue.Enabled := false; SmartFalse.Enabled := false; end; '+','.' : begin SmartA.Enabled := true; SmartB.Enabled := true; SmartC.Enabled := true; SmartTrue.Enabled := true; SmartFalse.Enabled := true; end; end; [/code] I want A,B,C etc to disable other inputs and then operators to enable inputs again. It kinda works but is acting weird but I dont want to write this out the long ass way.
How do I create SFML 2.0 for VS2010? If you could just link me a zip or something, that would be great. I am using the SVN version. For some reason, it only created DLLs for audio, network, and system.
You just download the source and build it... shouldn't be any more complicated than that.
-snip compiled 1.6 instead of 2.0 it works now-
-snip- I am an idiot.
[QUOTE=q3k;26340558]-snip- I am an idiot.[/QUOTE] Great 100th page king Anyway, I need some help with this: [IMG]http://i.imgur.com/q5Z1u.png[/IMG] I have a player object in the middle of my screen. I want a method that'll return an index (0-7) depending on which "sector" the mouse is in. I have a method of finding this at the moment, but it's horribly hacky and I'd like a better solution. Anyone have any nice (preferably fast) solutions? Edit: Sorry about the weird looking image, I had to rotate it by 22.5 degrees :v:
[QUOTE=Chris220;26341147]Great 100th page king Anyway, I need some help with this: [img_thumb]http://i.imgur.com/q5Z1u.png[/img_thumb] I have a player object in the middle of my screen. I want a method that'll return an index (0-7) depending on which "sector" the mouse is in. I have a method of finding this at the moment, but it's horribly hacky and I'd like a better solution. Anyone have any nice (preferably fast) solutions? Edit: Sorry about the weird looking image, I had to rotate it by 22.5 degrees :v:[/QUOTE] [cpp]const std::size_t index = arcos(normalized(playerPos - mousePos).dot(Vector::fromAngle(-22.5f))) * (1 / (PI / 4));[/cpp] I think.
I'm a tad bit frustrated, I've been trying for a week and can't get any IDE/Compiler to work. Now, I'm pretty clueless when it comes to programming, so please bear with me. Every time I try to compile this: [code]// my first program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }[/code] However, I get this error when I try to compile (Code::Blocks): [code]||=== cplusplus tutorials, Debug ===| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|3|error: iostream: No such file or directory| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c||In function 'main':| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: 'cout' undeclared (first use in this function)| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: (Each undeclared identifier is reported only once| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: for each function it appears in.)| ||=== Build finished: 5 errors, 0 warnings ===|[/code]
[QUOTE=Zally13;26341682]I'm a tad bit frustrated, I've been trying for a week and can't get any IDE/Compiler to work. Now, I'm pretty clueless when it comes to programming, so please bear with me. Every time I try to compile this: [code]// my first program in C++ #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }[/code] However, I get this error when I try to compile (Code::Blocks): [code]||=== cplusplus tutorials, Debug ===| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|3|error: iostream: No such file or directory| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c||In function 'main':| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: 'cout' undeclared (first use in this function)| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: (Each undeclared identifier is reported only once| C:\Users\Zally\Documents\C++\Learning\cplusplus tutorials\cplusplus tutorials\1_structure_of_a_program_1.c|8|error: for each function it appears in.)| ||=== Build finished: 5 errors, 0 warnings ===|[/code][/QUOTE] What IDE are you using? Because it seems that it can't find iostream. [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean? [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean?
[QUOTE=ZeekyHBomb;26341453][cpp]const std::size_t index = arcos(normalized(playerPos - mousePos).dot(Vector::fromAngle(-22.5f))) * (1 / (PI / 4));[/cpp] I think.[/QUOTE] Many times better than what I had before, thanks :D
[QUOTE=WTF Nuke;26341709]What IDE are you using? Because it seems that it can't find iostream. [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean? [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean?[/QUOTE] I means Time To Debug!
[QUOTE=WTF Nuke;26341709]What IDE are you using? Because it seems that it can't find iostream. [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean? [editline]27th November 2010[/editline] First-chance exception at 0x541c3be1 in SFML Game.exe: 0xC0000005: Access violation reading location 0x3f800014. What does it mean?[/QUOTE] Well, how would I get it to find Iostream?
I should be in the default include-paths of the compiler. Try re-installing the program you use.
I had this issue on another computer as well, so I should reinstall GNU GCC?
[QUOTE=ZeekyHBomb;26342124]I means Time To Debug![/QUOTE] But it is an error with collision. COLLISION.
I think I spotted the error. You probably have gcc as your compiler, which will judge from the fileending .c that you're compiling C-code. Either set your compiler to g++ or change the ending to .cc, .cp, .cxx, .cpp, .CPP, .c++ or .C (at least my gcc will compile them as C++ unless I tell it otherwise). [editline]28th November 2010[/editline] [QUOTE=WTF Nuke;26342832]But it is an error with collision. COLLISION.[/QUOTE] Access Violation on 0x3f800014 sounds like accessing invalid pointer. Why not investigate that with a debugger, regardless of what you think is the problem? [editline]28th November 2010[/editline] Oh also, using .cpp as ending for C++ source files is the most common. As for header-files (you'll be learning about them at some point) usually have the extention .h or .hpp, though I prefer .hpp because unlike .h it's not associated with C and is quite well accompanied with .cpp. [editline]28th November 2010[/editline] Oh also, using .cpp as ending for C++ source files is the most common. As for header-files (you'll be learning about them at some point) usually have the extention .h or .hpp, though I prefer .hpp because unlike .h it's not associated with C and is quite well accompanied with .cpp.
Since I am absolutely awful at C++ (and absolutely willing to take criticism), could anyone take a quick look at that code and let me know if there's anything that can be done obviously better? Especially the string handling code makes me wonder whether there is no simpler way to concatenate wstrings in C++ without using a fuckton of +='s/.appends. [url=https://github.com/SergeB/cppmcs]cppmcs[/url]
[QUOTE=ZeekyHBomb;26342890]Access Violation on 0x3f800014 sounds like accessing invalid pointer. Why not investigate that with a debugger, regardless of what you think is the problem?[/QUOTE] I seem to have pinned down the error to the main character teleporting deep into the floor a frame after spawning (3rd tick). This then causes the collision detector to attempt to check with tiles that do not exist. The strange part however is that I have checked every piece of code that changed the main character's position, specifically you.SetPosition() and you.Move (using SFML). Got any ideas on what could change the player's co-ordinates? And it's only the X axis.
[QUOTE=ZeekyHBomb;26342890]I think I spotted the error. You probably have gcc as your compiler, which will judge from the fileending .c that you're compiling C-code. Either set your compiler to g++ or change the ending to .cc, .cp, .cxx, .cpp, .CPP, .c++ or .C (at least my gcc will compile them as C++ unless I tell it otherwise). [editline]28th November 2010[/editline] Access Violation on 0x3f800014 sounds like accessing invalid pointer. Why not investigate that with a debugger, regardless of what you think is the problem? [editline]28th November 2010[/editline] Oh also, using .cpp as ending for C++ source files is the most common. As for header-files (you'll be learning about them at some point) usually have the extention .h or .hpp, though I prefer .hpp because unlike .h it's not associated with C and is quite well accompanied with .cpp. [editline]28th November 2010[/editline] Oh also, using .cpp as ending for C++ source files is the most common. As for header-files (you'll be learning about them at some point) usually have the extention .h or .hpp, though I prefer .hpp because unlike .h it's not associated with C and is quite well accompanied with .cpp.[/QUOTE] Saving it as a C/C++ Source in Code::Blocks automatically saves it as a .c file, which is annoying. I could simply save it as all files and save it as <project_name>.cpp, but is there a way to make sure it saves as .cpp? Oh, and saving it as .cpp worked, thanks!
Adding .cpp to the end of the file name?
No, a way to do it automatically when I select C/C++ file in Code::Blocks. I already do that, but I don't want to have to do it every time.
I'm doing some Hl2 coding, and I'm creating a brush entity that's going to fire outputs when the player uses it. However, when I include buttons.h so I can derive from CBaseButton, I get a rather peculiar error. [code]error C2146: syntax error : missing ';' before identifier 'm_ls'[/code] Now, this error is quite common, but what's strange is that I don't get any errors unless I include the header file. What's even weirder is that the header file is included elsewhere. The line that gets the error is [code] locksound_t m_ls; // door lock sounds[ [/code] Anyone might know what's up?
Are you missing a semicolon at the end of a class definition in your header? I'm guessing the "locksound_t m_ls;" is the first line in your file. If it's preceded (in a header) by a class definition with no semicolon, the compiler sees this: [cpp] class Foo { // ... } locksound_t m_ls; [/cpp] which declares an instance of Foo named "locksound_t", followed by a syntax error because there should've been either a comma or a semicolon before "m_ls".
[QUOTE=Zally13;26345568]No, a way to do it automatically when I select C/C++ file in Code::Blocks. I already do that, but I don't want to have to do it every time.[/QUOTE] Can't you just make a C::B C++ project that already does all the needed stuff for you, so you just have to write the code?
[QUOTE=sim642;26350250]Can't you just make a C::B C++ project that already does all the needed stuff for you, so you just have to write the code?[/QUOTE] Yeah, I kind of feel stupid. I was creating the file in a weird way. I got it the proper way now.
[QUOTE=Wyzard;26349116]Are you missing a semicolon at the end of a class definition in your header? I'm guessing the "locksound_t m_ls;" is the first line in your file. If it's preceded (in a header) by a class definition with no semicolon, the compiler sees this: class Foo { // ... } locksound_t m_ls; which declares an instance of Foo named "locksound_t", followed by a syntax error because there should've been either a comma or a semicolon before "m_ls".[/QUOTE] That's what's odd. I can't find anything wrong with the code at all. Here's the surrounding code: bool m_fStayPushed; // button stays pushed in until touched again? bool m_fRotating; // a rotating button? default is a sliding button. locksound_t m_ls; // door lock sounds byte m_bLockedSound; // ordinals from entity selection byte m_bLockedSentence; What's strange is that this isn't my code. It's Valve's default one.
A friend of mine asked me to post this here, since he can't register a FP account at the moment(email system is broken or whatever). [url]http://www.cplusplus.com/forum/beginner/32173/[/url]
I forgot what it is called but I hope somebody can tell me. Something to do with random integers. New rand = random.nextint(6) or something. I need it for a dice. I can't find out how to type it properly. Edit: Found it. [editline]28th November 2010[/editline] [cpp] import java.util.Random; public class dice { public static void main (String[] arg) { int t = 0; Random rand = new Random (); for (int counter=0; counter<=10; counter++) { t++; rand.nextInt(6); System.out.println(rand); } } } [/cpp] I want to print out the value that rand gets every time the for loops. But it just returns java.util.Random@addbf1. What am I doing wrong? And ignore int t for now.
Sorry, you need to Log In to post a reply to this thread.