Hello all! Merry Xmas!
I am new to C++ and I tryed to understund how windows work in this language so I found this code and compiled it. What I can see is that exept the window I get a cmd. How can I remove that? I can not find the code that creates it.
Thanks! Merry Xmas!
windows.h creates a new window. Its in the first line of code, the include. You can read more here
windows.h - Wikipedia, the free encyclopedia
Thanks but ... there is the same thing (windows.h) in a default win32 project of Dev-c++ and no cmd is displayed. Anyways I found why that cmd apears and it is because I had started a cmd project ... but I get more comfused here ... shuldn't it be displayed with some kind of code? What does it make the cmd to apear. sorry for making such questions but I've been programing in vb until now and I just faced some of the dificulties of C++ (all these compilers and the diferences betwen them, the more code etc). But I still want to continue learning it.
I don't program C++, what I posted earlier is all I know about that, sorry
Its just the entry point on the linker script. When you create a GUI project, it links in some object code that actually sets it up, and sets it as the entry point. That function then calls main(). Use objdump to see the symbols in your project and you'll notice it.
Thanks for the information but as I see I know really just a few things about C++ and I have started trying to learn it. So please, could you give me some links. Or could you explain to me some of the theory of C++? One thing I find difficult to understand is the differences between the compilers. In vb.net there were no/minimal difficulties getting some code from the net and running it. Now that I tried C++ ... EVERY sample that I get has some kind of problem working on dev-cpp. I do not know if that code actually runs on other compilers (so dev-cpp is the problem), if it runs on other computers (so my pc has the problem because it's vista H-P or something). How on earth am I going to learn if I do not have the ability to run some ready code to see what it does? I get some errors that look really stupid on first sight. For example: I got this dialog based code, unzipped it, double-clicked 'main.cpp' and on dev-cpp pressed 'Execute' --> 'Compile & Run' an I got a bunch of stupid errors likeOk ... I found that line and did not know what to do. OK I do not know nearly any C++ at all but aren’t these samples supposed to help me learn. Sorry if the way I have chosen to learn sounds stupid but it was the best one in VB. I read books about C++ but when I try to go a bit further like I did in VB I get stuck because of some compiling error. I even got an error about something that was undeclared (inside an ‘if’ loop) which was actually declared at the beginning of the code. Am I doing something wrong here?Code:156 C:\Users\sakishrist\Desktop\projects\dialogs\Main.cpp `_set_new_handler' undeclared (first use this function)
Thanks!
You may be getting errors in dev-cpp because you are using the wrong project type. If the project type is not a windows application then you need to select console application as your project type. If it is a windows application, you need to select win32 application as your file type. You should probably visit a few tutorial sites or the tutorials in the C++ section of codecall if you are attempting to learn C++. Most of these tutorials will probably use programs that run in the console for examples. Programming a windows application in C++ is a more advanced concept and should only be attempted after learning about classes. You should also check to see if the code you are using as an example was written and compiled in Dev-C++ originally or not. Programs written in Microsoft Visual C++ for example will not run the same in Dev-C++. If you continue to run into compiling errors, you may want to consider switching compilers.
It also depends on what file extensions you're using. For example, if you put C++ code in a file saved with the .c extension (for example, example.c), the compiler will probably choke and spit out a bunch of errors because it's trying to interpret the C++ code as pure C code. I've had that problem, took me forever to figure it out.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks