Author Topic: i'm very much a beginner in need of help :(  (Read 9818 times)

puhatch

  • Guest
i'm very much a beginner in need of help :(
« on: September 04, 2008, 12:04:02 am »
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.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2769
Re: i'm very much a beginner in need of help :(
« Reply #1 on: September 04, 2008, 12:44:55 am »
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

  • Guest
Re: i'm very much a beginner in need of help :(
« Reply #2 on: September 04, 2008, 01:21:33 am »
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.

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #3 on: September 04, 2008, 01:23:57 am »
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

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: i'm very much a beginner in need of help :(
« Reply #4 on: September 04, 2008, 01:33:01 am »
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.

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #5 on: September 04, 2008, 02:21:28 am »
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

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: i'm very much a beginner in need of help :(
« Reply #6 on: September 04, 2008, 03:06:15 am »
vista? this might help http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista

if not, what os, cb ver, compiler and ver?

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #7 on: September 05, 2008, 05:19:17 pm »
Windows XP, Code::Blocks 8.02, MinGW 5.1.4

~~ Paul

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2769

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #9 on: September 05, 2008, 05:49:52 pm »
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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: i'm very much a beginner in need of help :(
« Reply #10 on: September 05, 2008, 07:43:22 pm »
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".

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #11 on: September 05, 2008, 08:40:31 pm »
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

 

 
« Last Edit: September 05, 2008, 08:45:03 pm by Paul C. Anagnostopoulos »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: i'm very much a beginner in need of help :(
« Reply #12 on: September 05, 2008, 08:58:55 pm »
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.

Offline Paul C. Anagnostopoulos

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: i'm very much a beginner in need of help :(
« Reply #13 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: i'm very much a beginner in need of help :(
« Reply #14 on: September 05, 2008, 11:49:27 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".