News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

i'm very much a beginner in need of help :(

Started by puhatch, September 04, 2008, 12:04:02 AM

Previous topic - Next topic

puhatch

I've been taking Java classes for two years and I use "BlueJ" as a compiler. Compiling/Running programs on it is very simple and easy. A C++ book caught my eye at the book store and I bought it. Here is the first "starter" program it tells me to type...

int main(int argc, char* argv[])
{
        return 0;
}

I typed this in an empty file in Code::Blocks. Every time I press Build (which I assume is C++'s equivalent of Compile), it gives me 0 errors and 2 warnings. the warnings say:
"Warning W8057 : Parameter 'argc' is never used in funtion main"
"Warning W8057 : Parameter 'argv' is never used in funtion main"

And after I press Build, I press Run. And it prompts me that my file hasn't been built yet (even though I just built it) and nothing runs. So, if anyone could help with this, that would be great. And any other basic/beginner advice is extremely welcome.

Pecan

CUNY CodeBlocks Student Manual
http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf

This is *not* a programming forum. Questions must be particular to CodeBlocks.

You should find a good C++ forum and read the manual posted above.


puhatch

sorry. I thought that it was considered to be about CodeBlocks because i thought it was just a problem i was having with codeblocks. didn't mean to break rules.

Paul C. Anagnostopoulos

I have the same problem: Why does it tell me I haven't built my program yet when I just built it?

This problem, coupled with similar ones I'm having, makes me think that some of us do not understand Code::Block's build model.

~~ Paul

dmoore

Hi puhatch: works for me, so I suspect you must have something wrong with your compiler setup. what os, cb version and compiler are you using? (assuming you are on windows) if possible reinstall with the full mingw/gdb suite and make sure it is set to default under compiler settings.

another thing to try: use the wizard to create a project (file -> new -> project, select console app) and make sure that compiles and runs correctly.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Paul C. Anagnostopoulos

When I start Code::Blocks with my project loaded, make a simple change, and select Build, I get this build log:

mingw32-gcc.exe: 1: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings

If I then select Build a second time, I get:

[100.0%] Linking console executable: bin\Release\Freefall.exe
Output size is 31.23 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

This is somewhat disconcerting.

~~ Paul

dmoore

Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

Paul C. Anagnostopoulos

Windows XP, Code::Blocks 8.02, MinGW 5.1.4

~~ Paul


Paul C. Anagnostopoulos

Pecan, I'm not sure what you think you're addressing by posting those two documents. Neither of them helps me understand why I have to build my project multiple times in order to get it built, nor why my Resources list no longer lets me see the files in the project.

~~ Paul

Jenna

Quote from: Paul C. Anagnostopoulos on September 04, 2008, 02:21:28 AM
mingw32-gcc.exe: 1: No such file or directory

Can you post the full commandline ?

To switch it on change "Settings -> Compiler and debugger... -> Global compiler settings -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline".

Paul C. Anagnostopoulos

#11
Jens, here you are:

[ 50.0%] mingw32-gcc.exe -fexpensive-optimizations -O3 -Wall -Ddebug_mode 1  -g  -fexpensive-optimizations -O3 -Wall -g   -std=c99  -c C:\Freefall\freefall.c -o obj\Release\freefall.o
C:\Freefall\freefall.c: In function `main':
C:\Freefall\freefall.c:41: warning: implicit declaration of function `printf'
mingw32-gcc.exe: 1: No such file or directory
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 1 warnings

Second time:


-------------- Build: Release in Freefall ---------------

[100.0%] mingw32-g++.exe  -o bin\Release\Freefall.exe obj\Release\memory.o obj\Release\strings.o obj\Release\vm.o obj\Release\freefall.o   
Output size is 34.52 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

Two different compilers?

~~ Paul





Jenna

Remove the " 1"  from your "-Ddebug_mode 1" cause it's not needed and syntactical wrong.

If you define "debug_mode" it automatically is defined with the value 1.
If you want to give it a value explicitely use "-Ddebugmode=1".

Quote from the gcc-docs:
Quote
-D name
    Predefine name as a macro, with definition 1.
-D name=definition
    The contents of definition are tokenized and processed as if they appeared during translation phase three in a '#define' directive. In particular, the definition will be truncated by embedded newline characters.

The "1" is treated as the name of an inputfile in your case.

Paul C. Anagnostopoulos

Of course! Thank you so much. Things are working much better now.

Since you're being so helpful, can you tell me why my Management | Resources list includes my project (Freefall), but no sources list under it?

Again, thanks!

~~ Paul

Jenna

Quote from: Paul C. Anagnostopoulos on September 05, 2008, 09:54:44 PM
Of course! Thank you so much. Things are working much better now.

Since you're being so helpful, can you tell me why my Management | Resources list includes my project (Freefall), but no sources list under it?

Again, thanks!

~~ Paul


The resources list contains the wxSmith-resources, that means the frames/dialogs and there children.
But only if you have wxSmith-based wxWidgets project.
The files belonging to your project are in "Management -> Projects".