Author Topic: Compiler Errors None work at all  (Read 9594 times)

Offline Coaster3000

  • Single posting newcomer
  • *
  • Posts: 7
Compiler Errors None work at all
« on: August 11, 2010, 06:50:36 pm »
My specs
OS: XP service pack 3 Professional.
Code::Blocks 10.05.
REV 6283
I keep on getting errors when trying to compile anything. at all even the basic hello world app..

Code
||=== cppirc, Debug ===|
ld.exe||cannot find -lwxmsw29ud|
||=== Build finished: 1 errors, 0 warnings ===|

that one is for the minGW thing...

But there where other errors too.

Here is what im compiling on the hello world
Code
C:\Documents and Settings\Chris\My Documents\CPPirc\cppIRC\main.cpp||In function 'int main()':|
C:\Documents and Settings\Chris\My Documents\CPPirc\cppIRC\main.cpp|8|error: 'cout' was not declared in this scope|
C:\Documents and Settings\Chris\My Documents\CPPirc\cppIRC\main.cpp|8|error: wrong type argument to unary minus|
C:\Documents and Settings\Chris\My Documents\CPPirc\cppIRC\main.cpp|9|error: expected ';' before 'return'|
||=== Build finished: 3 errors, 0 warnings ===|
Code
#include <iostream>
#include <string>
#include <ctime>


int main()
{
    cout <- "Hello World"
return 0;
}

It won't run at all.
« Last Edit: August 11, 2010, 07:12:36 pm by Coaster3000 »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7594
    • My Best Post
Re: Compiler Errors None work at all
« Reply #1 on: August 11, 2010, 07:37:45 pm »
Fix decide if you are going to do C or C++. I am guessing C++ because of cout.
Next, add the missing ";" after the cout line. And change "<-" to the correct symbol!

http://www.cplusplus.com/doc/tutorial/program_structure/

NOTE: This is not a site to learn programming!!

Tim S.
« Last Edit: August 11, 2010, 07:42:45 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Coaster3000

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiler Errors None work at all
« Reply #2 on: August 11, 2010, 08:36:37 pm »
it still won't compile with that. i took that code out and left it with a return it would not compile. Ok if that was an error even if fixed it will not compile! Do not accuse me of it not compiling. its something wrong Not with the app. its some kind of settings i need help with. I am sure its settings. as i used the minGW compiler combo pack from here. Also tried installing the latest version which seems to not work!

Ld.exe fails to run properly within code blocks it is my guess

as a matter of fact here is the error again with it all fixed from that page

Code
#include <iostream>
#include <string>
#include <ctime>


using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}
Code
||=== cppirc, Debug ===|
ld.exe||cannot find -lwxmsw29ud|
||=== Build finished: 1 errors, 0 warnings ===|
« Last Edit: August 11, 2010, 08:39:09 pm by Coaster3000 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Coaster3000

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiler Errors None work at all
« Reply #4 on: August 11, 2010, 09:14:43 pm »
doesn't help does not fix my problem

here is log by the way
Quote
Build started on: 11-08-2010 at 14:57.11
Build ended on: 11-08-2010 at 14:57.12
-------------- Build: Debug in cppirc ---------------
mingw32-g++.exe -LC:\wxWidgets-2.9.1\lib\gcc_dll -L"C:\Documents and Settings\Chris\My Documents\Dev Packs (CodeBlocks)\lib" -o bin\Debug\cppirc.exe obj\Debug\main.o -mthreads -lwxmsw29ud -mwindows
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwxmsw29ud
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7594
    • My Best Post
Re: Compiler Errors None work at all
« Reply #5 on: August 11, 2010, 09:21:47 pm »
Does the folder C:\wxWidgets-2.9.1\lib\gcc_dll  contain the library wxmsw29ud?
If not, please fix the path, remove the library or compile the library if it is needed.
Note: I have no reason to believe your hello world requires wxWidgets 2.9 Unicode Debug Library. Do you?

Edit: Please learn the different between Compiler Errors, Linker errors, and Logic errors.
(I did not see any Logic Errors; but any big program tends to have a few till the program works right.)
In the long term this will help you a lot with programming in C.

Tim S.
« Last Edit: August 11, 2010, 09:26:15 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Coaster3000

  • Single posting newcomer
  • *
  • Posts: 7
Re: Compiler Errors None work at all
« Reply #6 on: August 11, 2010, 09:26:19 pm »
I am gonna use this library for something. The startup came with that when i added my file :P so i tested the compile to see if it worked. and it did not even compile.. let me try setting up a regular app

EDIT:
It works with regular app how do i set up the WX lib thing then?

EDIT AGAIN:

here is log without the cout function

Quote
Build started on: 11-08-2010 at 15:27.31
Build ended on: 11-08-2010 at 15:27.31
-------------- Build: Debug in cppirc ---------------
mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wno-attributes -Wall -g -D__WXDEBUG__ -IC:\wxWidgets-2.9.1\include -IC:\wxWidgets-2.9.1\contrib\include -IC:\wxWidgets-2.9.1\lib\gcc_dll\mswud -I"C:\Documents and Settings\Chris\My Documents\Dev Packs (CodeBlocks)\include" -c "C:\Documents and Settings\Chris\My Documents\CPPirc\cppIRC\main.cpp" -o obj\Debug\main.o
cc1plus.exe: error: unrecognized command line option "-Wno-attributes"
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

ok wait i think the thing is not even compiled all i did was use the installer for wxWidgets...
« Last Edit: August 11, 2010, 09:56:48 pm by Coaster3000 »