[QUOTE=artanis;33952546]Put all of the source file names in the command, not just the main one.[/QUOTE]
What?
[QUOTE=sim642;33952842]That doesn't work! i is never equal to x and j is never equal to y. It should be "i==0 || j==0 || i==x-1 || j==y-1" instead.[/QUOTE]
Or rather, change i < x to i <= x and so on.
Which makes considerably more sense.
[QUOTE=Meatpuppet;33953119]What?[/QUOTE]
You have to compile every source file together not just the main one.
[QUOTE=Octave;33953167]You have to compile every source file together not just the main one.[/QUOTE]
I don't know what you're talking about.
[QUOTE=Meatpuppet;33953178]I don't know what you're talking about.[/QUOTE]
What command are you using to compile?
[QUOTE=Octave;33953191]What command are you using to compile?[/QUOTE]
Build and run?
[QUOTE=Meatpuppet;33953217]Build and run?[/QUOTE]
Oh, you're using an ide, well then you have to make it compile every source file, otherwise you won't have your functions and such from the other files.
[QUOTE=Octave;33953270]Oh, you're using an ide, well then you have to make it compile every source file, otherwise you won't have your functions and such from the other files.[/QUOTE]
What do you mean?
[QUOTE=BlkDucky;33953161]Or rather, change i < x to i <= x and so on.
Which makes considerably more sense.[/QUOTE]
Considerably more sense, providing you want to get an out-of-bounds array index error :P
[QUOTE=Meatpuppet;33953289]What do you mean?[/QUOTE]
You're only compiling one .cpp file, whereas the functions are located in other .cpp files. You need to build all of them at the same time. What application are you using for development? There should be a way to change the compilation settings.
[QUOTE=Meatpuppet;33953289]What do you mean?[/QUOTE]
Your other .cpp file needs to be part of the project.
[QUOTE=Octave;33953306]You're only compiling one .cpp file, whereas the functions are located in other .cpp files. You need to build all of them at the same time. What application are you using for development? There should be a way to change the compilation settings.[/QUOTE]
Code::blocks. I don't know what compiling means.
I have a few questions about headers:
Q1: Are classes and namespaces the only thing you can declare in the header?
Q2: Do you only declare variables in the headers and assign them in the cpp? If so, how come?
Q3: Do you put the cpp and the header where main.cpp is located at?
Q4: How do I link the headers to "main.cpp"? Is a matter of saying "#include "header.h""?
Q5: Do the headers have to be linked in a specific order? Let's say that I have a graphical API, with the headers "load.h", "initialize.h", and "handle_events.h". Do I put it in this order: "Graphical_API.h", "load.h", "initialize.h", "handle_events.h", or it doesn't matter?
[QUOTE=Meatpuppet;33953828]Code::blocks. I don't know what compiling means.[/QUOTE]
Compiling is the translation of C++ or another language to assembly language, and then to a binary format, and finally to an executable binary format that the CPU can understand and run. It's the "build" from "build and run".
How do I compile more than one?
[QUOTE=BlkDucky;33951540]then just
[csharp]
MapArray = new char[x, y];
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
if (i == 0 || j == 0 || i == x || j == y)
MapArray[i][j] = '*';
else
MapArray[i, j] = ' ';
}
}
[/csharp]
or something[/QUOTE]
Not only is this far more effort than just typing your string literal result, it's also about as many keystrokes at this point!
Talk about over-engineering the problem :v:
[QUOTE=Meatpuppet;33953896]How do I compile more than one?[/QUOTE]
Well if you go to Project > Add files you can add files to your project; add the other ones where your functions are defined and hit build and run.
[QUOTE=Octave;33954024]Well if you go to Project > Add files you can add files to your project; add the other ones where your functions are defined and hit build and run.[/QUOTE]
I have main.cpp, spaceship.h, and spaceship.cpp all in the same window, as I have had them. It still says "undefined reference" to all of my spaceship.cpp funcs.
[editline]29th December 2011[/editline]
Oh nevermind.
[QUOTE=Meatpuppet;33953896]How do I compile more than one?[/QUOTE]
Just read [url]http://wiki.codeblocks.org/index.php?title=Creating_a_new_project[/url] like you should have done to begin with instead of asking questions already well documented.
Thanks, now it's just giving me a run-time error. Onward to fix that, I guess. *sigh*
[editline]29th December 2011[/editline]
Automerge
[editline]29th December 2011[/editline]
[QUOTE=subenji99;33954058]Just read [url]http://wiki.codeblocks.org/index.php?title=Creating_a_new_project[/url] like you should have done to begin with instead of asking questions already well documented.[/QUOTE]
I didn't have access to it, I was on my phone
[editline]29th December 2011[/editline]
Can anyone tell me why this is crashing when it runs?
[url]http://pastebin.com/BHdZbVsA[/url]
[quote=CoolKingKaso;33953843]Q1: Are classes and namespaces the only thing you can declare in the header?[/quote]
You can declare anything in headers, but normally they're used for function prototypes and forward declaration stuff without defining function bodies and full code.
[quote]Q2: Do you only declare variables in the headers and assign them in the cpp? If so, how come?[/quote]
Depends on what kind of variables they are, if they're in classes, etc
[quote]Q3: Do you put the cpp and the header where main.cpp is located at?
Q4: How do I link the headers to "main.cpp"? Is a matter of saying "#include "header.h""?[/quote]
You put both files (.cpp, .h) in the same folder, and pop an #include header.h at the top of the cpp. You can use subdirectories too, e.g. #include "graphics/sprite.h".
[quote]Q5: Do the headers have to be linked in a specific order? Let's say that I have a graphical API, with the headers "load.h", "initialize.h", and "handle_events.h". Do I put it in this order: "Graphical_API.h", "load.h", "initialize.h", "handle_events.h", or it doesn't matter?[/quote]
Doesn't generally matter, unless you're a terrible person like me and use stuff from one header in another header.
[QUOTE=Meatpuppet;33954064][editline]29th December 2011[/editline]
I didn't have access to it, I was on my phone[/QUOTE]
:wtc:
Using Code::Blocks, trying solutions people are pointing out, but no net access? I suspect bullshit.
(also paste the run-time error. They may look cryptic, but they state exactly where your program ran into problems.)
[QUOTE=subenji99;33954318]:wtc:
Using Code::Blocks, trying solutions people are pointing out, but no net access? I suspect bullshit.
(also paste the run-time error. They may look cryptic, but they state exactly where your program ran into problems.)[/QUOTE]
No, I mean I can't access the wiki on my phone. If you look at the posts where I asked, you can see I posted it from a phone. The browser on it fucks up when it gets to pages that are not meant for mobile phones.
[editline]29th December 2011[/editline]
Also, I don't think this is it.
[quote]Executing: "D:\CodeBlocks/cb_console_runner.exe" "D:\C++ stuff\Orbital Insertion\bin\Debug\Orbital Insertion.exe" (in D:\C++ stuff\Orbital Insertion\.)
Process terminated with status -1073741510 (0 minutes, 2 seconds)[/quote]
[QUOTE=subenji99;33954000]Not only is this far more effort than just typing your string literal result, it's also about as many keystrokes at this point!
Talk about over-engineering the problem :v:[/QUOTE]
And what if you want varying map sizes?
[QUOTE=BlkDucky;33954531]And what if you want varying map sizes?[/QUOTE]
It's still going to be less effort, until at least 100x100 map sizes or at least 10 unique maps.
How do I find a run time error message in Code::Blocks? Google gave no answers.
[QUOTE=Meatpuppet;33954344][editline]29th December 2011[/editline]
Also, I don't think this is it.[/QUOTE]
Are you compiling with a "Release" target? You should be using "Debug" until the very final last compile before distributing. That should then compile with debug symbols, and you'll get better debug output to use.
Nethertheless, the return value IS informative to a point, stating that the failure was in an include, (as you never exit with any return code other than 0 or 1.) but won't say which. Assume SFML though, meaning it'll be a line in your code that uses something SFML.
[QUOTE=subenji99;33954637]Are you compiling with a "Release" target? You should be using "Debug" until the very final last compile before distributing. That should then compile with debug symbols, and you'll get better debug output to use.
Nethertheless, the return value IS informative to a point, stating that the failure was in an include, (as you never exit with any return code other than 0 or 1.) but won't say which. Assume SFML though, meaning it'll be a line in your code that uses something SFML.[/QUOTE]
I have always used debug.
[QUOTE=subenji99;33954558]It's still going to be less effort, until at least 100x100 map sizes or at least 10 unique maps.[/QUOTE]
You mean two maps, assuming:
[quote]it's also about as many keystrokes at this point![/quote]
But whatever, I really can't see how what I posted is any more effort at all, honestly.
Still no more info, I'll look into what you said
[editline]29th December 2011[/editline]
argh
[editline]29th December 2011[/editline]
[QUOTE=subenji99;33954637]Are you compiling with a "Release" target? You should be using "Debug" until the very final last compile before distributing. That should then compile with debug symbols, and you'll get better debug output to use.
Nethertheless, the return value IS informative to a point, stating that the failure was in an include, (as you never exit with any return code other than 0 or 1.) but won't say which. Assume SFML though, meaning it'll be a line in your code that uses something SFML.[/QUOTE]
The only thing in my include files that uses SFML is a function that I already know works, which is the function to get the filename of the sprite I'm using for the ship. Hmm.
Sorry, you need to Log In to post a reply to this thread.