C :: Code Blocks Not Compiling Project - BattleShip Game
Nov 26, 2013
I'm trying to compile my project, but is not working, the weird thing is if i put all the code in 1 file it compile, but not in a project, source code:
I'm pretty new to C++ and I'm on Binary Trees in "Jumping into C++"! I've just created a DLL project on Code::Blocks, and I cannot get it to build and run: "You must select a host application to "run" a library..." is the message that I'm getting when I run the main code file. It's had no changes to it (except for a few extra, unnecessary line feeds), and it's the file which Code::Blocks generates on a DLL project.
I have created a game.It is working fine in codeblocks, but when I am trying to run it outside codeblocks, it opens and closes immediately. I have pasted all the necessary files and dlls in root folder and debug folder. Here is the code:-
This has happened before, when I try to run a code it will say "blah.exe has stopped working" and I would have to change the code in some way to make it work.
I'm using Code Blocks but for some reason it doesn't process alt symbols. You know... alt symbols are like this: ☺♫↓☻♪♥↕. Code Blocks says that they're "invalid characters". Is there any attatchments or mods so Code Blocks can process them or will changing the settings?
I'm unable to use the function random(num); in Code::Blocks. It shows the error : error: 'random' was not declared in this scope while the same code works fine in Borland's Turbo C++. How do I rectify this?
I find myself in a position where I am repeating the same pattern of, write shared lib, compile, link shared lib, write app lib "sandbox" dependent on shared lib, write shared lib, compile, link, write...
At each level of dependency I have to carry over previously shared libs, search directories, etc. How to automate this process, so I spend less time linking after each layer?
how to get opengl working in code blocks? I have tried putting in the libraries and such in the correct folder. But I get an error saying that glut32.dll could not be found. I am running a 10.5 code blocks
In my c project in code blocks , I have added another source file (KillerMoves.c) and a header file under the same name (KillerMoves.h). I added the "include guard" to prevent double inclusion. But from some reason, the program suddenly crashes with no warning or specific error. Without the new files,the program runs without any problems. This is the source .c file:
Code:
#include "KillerMoves.h" void initKillersTable(){ for(int i = 0; i < 15; i++){ killersTable[i] = -1;
I'm using Code:Blocks 12.11 on windows 7, with the built-in MinGW compiler. When I try and compile a program that has an error in it (misnamed variable, missing include, extra semi-colon somewhere, anything) instead of saying something about what went wrong it just has this:
Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings (0 minutes, 0 seconds)
I want to show my output in one line. But my output breaks to next line even before endl is encountered.code blocks horizontal scroll bar in console? is it c++ formatting issue or console issue?
I want to make a basic RPG text based games with multiple classes. but I wan to know how In one class I make a variable and in another and can call the variable.
for exmaple
class2: int hi = 1; class1: class2 a; hi = 2; cout << hi; 2
I downloaded glew 1.9.0 files and dragged the lib, include, and bin of the glew into the mingw folder within Code Blocks. I don't know if this is the right thing to do I don't understand how this stuff works. Anyway, I tried to compile my openGL 3.0 program that uses glew and I got this error: The procedure entry point _glewBindArray could not be located in the dynamic link library glew32.dll, How do I install glew properly?
The number of parameters to this function is variable It has all types of variables, function calls, etc.
The code has thousands of these lines
There is now a need for a special version of the compile that will remove a lot of the code, among others is the logging.
Can I somehow #define the "logthis" name into something that'll remove all actual calls to the code. including the actual parameters/expressions to the call.
I can't afford to add #ifdef/#endif around each of the calls because there are too many of them, and because that'll cause some undisired side effects in our code conformance tests.
Code: #define logthis __noop
comes close, that removes the call, but it still causes the compiler to evaluate and validate all the parameters to the logthis function, which doesn't work because in this case, removing the logging headers also removes other members of the class that get used as part of the parameters to logthis()
if I could define logthis into // resulting in all the rest of the line being comments, but that doesn't work.
Preferably I'd like something to be portable, but I'll take a solution that only works on visual studio as well.
I've written a simple program that output's my name, course, and a time date stamp.
Having researched the code to do so, I've used the includes for both the ctime and time.h libraries.
I leveraged localtime_s and asctime_s to actually convert to string etc., and the program runs fine when I step through it in Visual Studio.
However, we're working with CGI and this program will ultimately be called up from the cgi-bin directory of a web server. The first thing that needs to be done after copying it to the webserver is to compile it. That's where my problem occurs.
Using the console command: g++ lab5a.cpp -o lab5a.exe the file is supposed to compile and be converted to a .exe.
However, instead I receive errors:
localtime_s was not declared in this scope asctime_s was not declared in this scope
I "believe" it's because of the included libraries, but not sure.
They are:
HTML Code: #include <iostream> #include <ctime> #include <time.h>
Here's the actual timestamp block of code:
HTML Code: //Begin date and time instructions time_t curTime; struct tm locTime; const int TimeStrLen = 26;
[Code] ....
Of course, I go on to error check and complete the block, but you get the picture.
I am creating an application which will work as a static code analyzer after compiling my code in VS 2008 for VC++ projects. It will be a kind of code review.
how and where do I need to put my custom rule sets, and what should I do to create such a application.
How to structure something like Game Menu. I was googling and did not find anything useful. I am coding a little game and Menu part with few sections like START GAME - SELECT LEVEL - SETTINGS (SOUND, MUSIC AND VIBRATION ON/OF) - CREDITS - EXIT.
And just menu alone seems to have tones of code. I have my state machine working but it seems every subsection of the menu has its own state sort if and duplicate code.
So far I have managed to write the code for a simple game (resembling to "Pacman") :P. Now what I want is to move the smiley in the upper left-hand corner of the map "automatically" when the program runs and also want it to change it's direction to up or down when it touches the wall.
Also the screen is flickering when the program runs (due to re-printing the whole array?). I want to stop this flicker. Somebody suggested to use 'gotoxy' function.
Here's my code :
#include <iostream> #include <conio.h> #include <stdlib.h> using namespace std; void display (char array [10][25] , int row , int column) {
I have a project which does a specific thing, like an open file dialog.
I would like to open it in a different project on a click of a button.
Also, It has a different namespace.
I'm guessing that it would involve a "using" statement to add the namespace And I will have to add reference to an *.exe or *.dll -> I'll have to look up how to make a *.dll, I know where the *.exe file is.
I have searched for a different things on Google, but I don't think that I am looking for the correct phrase (which is always frustrating...)
I'm working on my first video game. So far I have a few classes in the game starting with the Game class which includes a list of GameObjects (another class). There are several classes that inherit from GameObjects used to implement things like bullets, explosions, various enemy types, etc.
The game essentially iterates through the list of GameObjects to update/render them. I would like to provide access to the Game's list of GameObjects inside another class (like the Bullet class) so I can put new objects on the list. For example, when a bullet hits, I want to add an explosion to the Game's GameObject list it can be updated/rendered.
How this should be setup? I was considering adding a pointer to the Game or GameObject list to the GameObject class (and methods to access it), but I was wondering if there is a better way to set this up?