g++.exe -D__DEBUG__ -c "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Main.cpp" -o "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/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" -g3
g++.exe -D__DEBUG__ -c "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.cpp" -o "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.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" -g3
g++.exe -D__DEBUG__ "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Main.o" "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.o" -o "pro1.exe" -L"C:/Dev-Cpp/lib" "../../Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Lib/Gdi32.Lib" -g3
../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.o(.text+0x116): In function `ZN17Win32WrapperClass6CreateEv':
C:/Strom/pro1/../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.cpp:58: undefined reference to `GetStockObject@4'
collect2: ld returned 1 exit status
Now I figured because of the "undefined reference" error to GetStockObject that I had to link it's library; which I thought was the Gdi32.Lib file. So, I went to Project Options and into the Parameters tab and using the "Add Library or Object" I navigated to the Library and added into the linker box. Tried to recompile and got the above log.
I take it I'm not doing this right. Tried to look elsewhere for how to link but only found things for the command line.
I'm using Dev-C++ version 4.9.9.2
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, Wayne using that library did the trick. Real sorry for not catching the thread on your "Please Read" article about linking and headers, I will go over that.
Also much thanks for the tip on spaces in paths.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You do realize that you are asking for trouble by putting spaces in file names of code? It is a very very bad idea.
Now, there is another issue here. In general, libraries compiled by and for visual c++ can not be assumed to work with GCC, the compiler that Dev uses. Sometimes they will work. Frequesntly they will not.
In this case, there is already a library available that you need - its name, like most for GCC, is
libgdi32.a
You should find it in your lib folder.
I encourage you to check out the thread titled "Please Read Before Posting a Question" - in particular the section on including headers and linking libraries. It goes through the process of showing you how to do things. Note that command line commands can be entered through your Project menu. I still do it that way, issuing commands like
-lgdi32
to do the link that you are going to want to do.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Spaces in paths are probably not getting in the way of getting the library by the way.
If they had been, the report would be that the linker could not find the library in
question.
In general though, putting your project in a path with spaces in it, like your "My Documents"
folder, or your desktop will eventaully give you a problem. As will having spaces in
the names of the files that you use. I would avoid it - which is why I wrote the
admonition to not do it in the "Please Read" thread.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to learn some windows programming with this tutorial:
http://tinyurl.com/32rmua
But I guess he wants to use VC++ and I want to use Dev-C++.
So, compiled his code for this stage of his tutorial and I get this error (log file):
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Compiler: Default compiler
Building Makefile: "C:\Strom\pro1\Makefile.win"
Executing make clean
rm -f "../Win32\ Tutorial\ Part\ 2\ -\ Creating\ a\ Win32\ Window\ Wrapper\ Class/Main.o" "../Win32\ Tutorial\ Part\ 2\ -\ Creating\ a\ Win32\ Window\ Wrapper\ Class/Win32WrapperClass.o" pro1.exe
g++.exe -D__DEBUG__ -c "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Main.cpp" -o "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/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" -g3
g++.exe -D__DEBUG__ -c "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.cpp" -o "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.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" -g3
g++.exe -D__DEBUG__ "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Main.o" "../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.o" -o "pro1.exe" -L"C:/Dev-Cpp/lib" "../../Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Lib/Gdi32.Lib" -g3
../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.o(.text+0x116): In function `ZN17Win32WrapperClass6CreateEv':
C:/Strom/pro1/../Win32 Tutorial Part 2 - Creating a Win32 Window Wrapper Class/Win32WrapperClass.cpp:58: undefined reference to `GetStockObject@4'
collect2: ld returned 1 exit status
make.exe: *** [pro1.exe] Error 1
Execution terminated
+++++++++++++++++++++++++++++++++++++
Now I figured because of the "undefined reference" error to GetStockObject that I had to link it's library; which I thought was the Gdi32.Lib file. So, I went to Project Options and into the Parameters tab and using the "Add Library or Object" I navigated to the Library and added into the linker box. Tried to recompile and got the above log.
I take it I'm not doing this right. Tried to look elsewhere for how to link but only found things for the command line.
I'm using Dev-C++ version 4.9.9.2
Thanks.
Yes, Wayne using that library did the trick. Real sorry for not catching the thread on your "Please Read" article about linking and headers, I will go over that.
Also much thanks for the tip on spaces in paths.
It could be that it doesn't like the spaces in the path to the lib maybe.
You do realize that you are asking for trouble by putting spaces in file names of code? It is a very very bad idea.
Now, there is another issue here. In general, libraries compiled by and for visual c++ can not be assumed to work with GCC, the compiler that Dev uses. Sometimes they will work. Frequesntly they will not.
In this case, there is already a library available that you need - its name, like most for GCC, is
libgdi32.a
You should find it in your lib folder.
I encourage you to check out the thread titled "Please Read Before Posting a Question" - in particular the section on including headers and linking libraries. It goes through the process of showing you how to do things. Note that command line commands can be entered through your Project menu. I still do it that way, issuing commands like
-lgdi32
to do the link that you are going to want to do.
Wayne
Spaces in paths are probably not getting in the way of getting the library by the way.
If they had been, the report would be that the linker could not find the library in
question.
In general though, putting your project in a path with spaces in it, like your "My Documents"
folder, or your desktop will eventaully give you a problem. As will having spaces in
the names of the files that you use. I would avoid it - which is why I wrote the
admonition to not do it in the "Please Read" thread.
Wayne