I tried to compile an example project which came with my Dev-C++ (version 4.9.9.2, win XP by the way), and got some errors that I cant figure out how to fix. The project is Jackpot, found in the folder Dev-cpp\Examples.
It has only one file, main.cpp which is composed of the main and two other functions. It generates random numbers for the user try to guess.
I supposed that an example should run OK, so maybe there's something wrong with my Dev-C++. Here is the log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Examples\Jackpot\Makefile.win"
Executing make clean
rm -f main.o Jackpot.exe
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc+0x59):ctype_members.cc: undefined reference to wctob'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc+0x8a):ctype_members.cc: undefined reference towctob'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE9do_narrowEwc+0x24):ctype_members.cc: undefined reference to wctob'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x5d):ctype_members.cc: undefined reference towctype'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x75):ctype_members.cc: undefined reference to wctype'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x9d):ctype_members.cc: undefined reference towctype'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xc9):ctype_members.cc: undefined reference to wctype'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xe1):ctype_members.cc: undefined reference towctype'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xf9):ctype_members.cc: more undefined references to wctype' follow
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNSt5ctypeIwE19_M_initialize_ctypeEv+0x25):ctype_members.cc: undefined reference towctob'
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNSt5ctypeIwE19_M_initialize_ctypeEv+0x3d):ctype_members.cc: undefined reference to btowc'
C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE9do_lengthERiPKcS3_j+0x50):codecvt_members.cc: undefined reference tombrtowc'
C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE5do_inERiPKcS3_RS3_PwS5_RS5+0x4c):codecvt_members.cc: undefined reference to mbrtowc'
C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE6do_outERiPKwS3_RS3_PcS5_RS5_+0x4f):codecvt_members.cc: undefined reference towcrtomb'
C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$ZNKSt7codecvtIwciE6do_outERiPKwS3_RS3_PcS5_RS5+0xab):codecvt_members.cc: undefined reference to `wcrtomb'
collect2: ld returned 1 exit status
make.exe: *** [Jackpot.exe] Error 1
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-06-13
I said "a bug in Dev-C++ that SOMETIMES causes projects below c:\dev-c++ to fail". Not always, but sometimes - but once is enough if it catches you one day, so best avoid. Besides 'polluting' the original installation is also probably best avoided - your work may be destroyed by a uninstall, re-install or upgrade.
The suggestion was not "a solution", it was just something you should do before we investigated further, to discount that possibility, and to prevent it from causing other problems while this one was investigated. It seems you have your solution in any case.
The bit about "'noticing' what I had already suggested" was referring to the correct use of the std:: namespace - I had earlier suggested that was what your problem was, and posting the code in the first place would have got you exactly that answer rather than my informed guess. Unfortunately because you either did not read or understand the point, it served no purpose, and you 'discovered' it for yourself.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-06-10
I just loaded and built the project unmodified here. I see nothing wrong with your build log up until the linker errors. One thing you should try is moving/copying the project to a folder outside of the Dev-C++ installation. In fact copy the whole Examples folder to say:
c:\devprojects\examples
There is apparently a bug in Dev-C++ that sometimes causes projects below c:\dev-c++ to fail in very peculiar and unpredictable ways. Make sure you do a Rebuild All after moving it.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've just tried this, used Rebuild All and got exactly the same problems.
I also noticed that when I include <iostream> on my programs, it seems to do nothing, but if I type <iostream.h> it works OK.
What can I do?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(1) Create a single file, non-project "Hello World", and place it in a folder like c:\mycstuff, and see if it compiles.
(2) If it does, create a simple, project version of "Hello World", in the same folder. See if that compiles.
If either does not compile, them make sure you post your compile log, starting from the beginning, through the first 5 or so errors if you have a lot.
If it were me, before I did any of this, I would do a clean uninstall (you can see the directions for doing this in the "Please Read Before Posting a Question" thread in this forum. If you go through this apparoach, PLEASE CAREFULLY note the rather strong directions in there about keeping exact track of what you did, and reporting it. It is very important to do this, and not fall into the "I did exactly what is said" trap that so many do.
You would be surprised how many people, given the STRONG directions in the thread, and a warning like I just typed in, who think adding something lile "I followed the directions TO THE LETTER" make it equivalent to telling us, step by step what they did.
I am making this huge hairy point of this NOT at all to insult you, but because knowing what you did, and might not have done is critical in debugging a cleanup.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-06-10
>> I've just tried this, used Rebuild All and got exactly the same problems.
Post the log for this. Sometimes it can hold subtle clues, it also confirms exactly what you did.
>> I also noticed that when I include <iostream> on my programs, it seems to do nothing, but if I type <iostream.h> it works OK.
Post the log for that too (with and without .h). What does "it seems to do nothing" mean, that seems unlikely that it did nothing, but it is quite likely that it failed to compile with error messages. Did you access the std:: namespace correctly? That is the primary difference between the deprecated and preferred headers.
>>What can I do?
Post the logs! ;-)
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, so I unninstalled it through the Control Panel, then deleted both the folders Dev-Cpp from Documents and Settings\USER\Application Data and from C:
When I reinstalled, I checked the option to erase all previous configuration files.
So, I used Rebuild All and Jackpot is running OK.
Now, concerning the <iostream> thing, it continues the same. Here is the log for a simple cout<<"hi" program using #include <iostream>:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Projects\hello.cpp" -o "C:\Projects\hello.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Projects\hello.cpp: In function int main()':
C:\Projects\hello.cpp:5: error:cout' undeclared (first use this function)
C:\Projects\hello.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
Execution terminated
The same file, now with <iostream.h>:
Compiler: Default compiler
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Projects\hello.cpp" -o "C:\Projects\hello.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,
from C:\Projects\hello.cpp:1:
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
Execution terminated
Compilation successful
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a good example by the way of why the Basic 3 are the Basic 3, and not the Basic 2.
The element of posting the code that you are compiling, rather than just describing it would
bring issues like this to the front more quickly.
I am writing this as much for the other readers of this thread as for you, providing the
full information, what you are compiling, how you are compiling it, on what you are compiling
it, and exactly what the compiler is telling you are what the Basic 3 are intended to provide.
In the end, you will get better answers, faster.
Glad you are up and going by the way.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to compile an example project which came with my Dev-C++ (version 4.9.9.2, win XP by the way), and got some errors that I cant figure out how to fix. The project is Jackpot, found in the folder Dev-cpp\Examples.
It has only one file, main.cpp which is composed of the main and two other functions. It generates random numbers for the user try to guess.
I supposed that an example should run OK, so maybe there's something wrong with my Dev-C++. Here is the log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Examples\Jackpot\Makefile.win"
Executing make clean
rm -f main.o Jackpot.exe
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
g++.exe main.o -o "Jackpot.exe" -L"C:/Dev-Cpp/lib"
C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc+0x59):ctype_members.cc: undefined reference to
wctob' C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE9do_narrowEPKwS2_cPc+0x8a):ctype_members.cc: undefined reference to
wctob'C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE9do_narrowEwc+0x24):ctype_members.cc: undefined reference to
wctob' C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x5d):ctype_members.cc: undefined reference to
wctype'C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x75):ctype_members.cc: undefined reference to
wctype' C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0x9d):ctype_members.cc: undefined reference to
wctype'C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xc9):ctype_members.cc: undefined reference to
wctype' C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xe1):ctype_members.cc: undefined reference to
wctype'C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNKSt5ctypeIwE19_M_convert_to_wmaskEt+0xf9):ctype_members.cc: more undefined references to
wctype' follow C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNSt5ctypeIwE19_M_initialize_ctypeEv+0x25):ctype_members.cc: undefined reference to
wctob'C:/Dev-Cpp/lib/libstdc++.a(ctype_members.o)(.text$_ZNSt5ctypeIwE19_M_initialize_ctypeEv+0x3d):ctype_members.cc: undefined reference to
btowc' C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE9do_lengthERiPKcS3_j+0x50):codecvt_members.cc: undefined reference to
mbrtowc'C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE5do_inERiPKcS3_RS3_PwS5_RS5+0x4c):codecvt_members.cc: undefined reference to
mbrtowc' C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$_ZNKSt7codecvtIwciE6do_outERiPKwS3_RS3_PcS5_RS5_+0x4f):codecvt_members.cc: undefined reference to
wcrtomb'C:/Dev-Cpp/lib/libstdc++.a(codecvt_members.o)(.text$ZNKSt7codecvtIwciE6do_outERiPKwS3_RS3_PcS5_RS5+0xab):codecvt_members.cc: undefined reference to `wcrtomb'
collect2: ld returned 1 exit status
make.exe: *** [Jackpot.exe] Error 1
Execution terminated
I said "a bug in Dev-C++ that SOMETIMES causes projects below c:\dev-c++ to fail". Not always, but sometimes - but once is enough if it catches you one day, so best avoid. Besides 'polluting' the original installation is also probably best avoided - your work may be destroyed by a uninstall, re-install or upgrade.
The suggestion was not "a solution", it was just something you should do before we investigated further, to discount that possibility, and to prevent it from causing other problems while this one was investigated. It seems you have your solution in any case.
The bit about "'noticing' what I had already suggested" was referring to the correct use of the std:: namespace - I had earlier suggested that was what your problem was, and posting the code in the first place would have got you exactly that answer rather than my informed guess. Unfortunately because you either did not read or understand the point, it served no purpose, and you 'discovered' it for yourself.
Clifford
I just loaded and built the project unmodified here. I see nothing wrong with your build log up until the linker errors. One thing you should try is moving/copying the project to a folder outside of the Dev-C++ installation. In fact copy the whole Examples folder to say:
c:\devprojects\examples
There is apparently a bug in Dev-C++ that sometimes causes projects below c:\dev-c++ to fail in very peculiar and unpredictable ways. Make sure you do a Rebuild All after moving it.
Clifford
I've just tried this, used Rebuild All and got exactly the same problems.
I also noticed that when I include <iostream> on my programs, it seems to do nothing, but if I type <iostream.h> it works OK.
What can I do?
Well, what I would try is the following:
(1) Create a single file, non-project "Hello World", and place it in a folder like c:\mycstuff, and see if it compiles.
(2) If it does, create a simple, project version of "Hello World", in the same folder. See if that compiles.
If either does not compile, them make sure you post your compile log, starting from the beginning, through the first 5 or so errors if you have a lot.
If it were me, before I did any of this, I would do a clean uninstall (you can see the directions for doing this in the "Please Read Before Posting a Question" thread in this forum. If you go through this apparoach, PLEASE CAREFULLY note the rather strong directions in there about keeping exact track of what you did, and reporting it. It is very important to do this, and not fall into the "I did exactly what is said" trap that so many do.
You would be surprised how many people, given the STRONG directions in the thread, and a warning like I just typed in, who think adding something lile "I followed the directions TO THE LETTER" make it equivalent to telling us, step by step what they did.
I am making this huge hairy point of this NOT at all to insult you, but because knowing what you did, and might not have done is critical in debugging a cleanup.
Wayne
>> I've just tried this, used Rebuild All and got exactly the same problems.
Post the log for this. Sometimes it can hold subtle clues, it also confirms exactly what you did.
>> I also noticed that when I include <iostream> on my programs, it seems to do nothing, but if I type <iostream.h> it works OK.
Post the log for that too (with and without .h). What does "it seems to do nothing" mean, that seems unlikely that it did nothing, but it is quite likely that it failed to compile with error messages. Did you access the std:: namespace correctly? That is the primary difference between the deprecated and preferred headers.
>>What can I do?
Post the logs! ;-)
Clifford
Ok, so I unninstalled it through the Control Panel, then deleted both the folders Dev-Cpp from Documents and Settings\USER\Application Data and from C:
When I reinstalled, I checked the option to erase all previous configuration files.
So, I used Rebuild All and Jackpot is running OK.
Now, concerning the <iostream> thing, it continues the same. Here is the log for a simple cout<<"hi" program using #include <iostream>:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Projects\hello.cpp" -o "C:\Projects\hello.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Projects\hello.cpp: In function
int main()': C:\Projects\hello.cpp:5: error:
cout' undeclared (first use this function)C:\Projects\hello.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
Execution terminated
The same file, now with <iostream.h>:
Compiler: Default compiler
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Projects\hello.cpp" -o "C:\Projects\hello.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,
from C:\Projects\hello.cpp:1:
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
Execution terminated
Compilation successful
Oh, I've just noticed I didnt put using namespace std on the Hello World code. When I put, it works fine.
Well done for 'noticing' what I had already suggested was your problem! ;-)
This is a good example by the way of why the Basic 3 are the Basic 3, and not the Basic 2.
The element of posting the code that you are compiling, rather than just describing it would
bring issues like this to the front more quickly.
I am writing this as much for the other readers of this thread as for you, providing the
full information, what you are compiling, how you are compiling it, on what you are compiling
it, and exactly what the compiler is telling you are what the Basic 3 are intended to provide.
In the end, you will get better answers, faster.
Glad you are up and going by the way.
Wayne
So, the original solution to his problem was to move the example files to a seperate folder outside of the dev-cpp folder?
I'm also using version 4.9.9.2, but on a win98 machine. Jackpot compiled and ran fine inside the dev-cpp folder the way it was originally packaged.
Uhhh, no, read his last couple of posts again.
After doing a clean uninstall and install, Jackpot worked fine.
Later, dealing with the namespace issue - the iostream problem went away.
Wayne