I have a file that I am trying to include in a program. I can compile fine on a Unix system but when trying to complile with Dev-C++ I get the following error. This is the only error but I have no idea what is causing it. Any help would be greatly appreciated
[Linker error] undefined reference to "WinMain@16"]
The file I am trying to compile is just a series of functions
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What has happened most times is that you are writing a console apllication (which is consistent from having been on Unix before), but when you started your project, you chose to start a windows project, which, instead of a main function, requires a winmain function. If this is the case, start over with a console project...
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I hadn't looked at the FAQs but before I posted here my first thought was exactly what you posted Mr. Keen thanks I appreciate the reply.
I started a new console project and then entered the code from my original file. It still will not compile.
The main exe compiles fine as long as the #include is commented out. I have built several other console applications and not had this problem
The file I am having trouble with also has a #include which is a .h file that has my class definintion.
I have been using Dev-C++ for a few months and this is the first real problem I have run into.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"The main exe compiles fine as long as the #include is commented out"
Uhhh, what include would that be? You mentioned nothing about an include in your first post to the thread. I get the feeling you are continuing from another thread?
It would help a lot if you would:
(1) Provide a simple code example that shows the problem you are having...the simpler the better
(2) *Always* pos the full compile log that you get, do not just post the error.
(3) Always mention what version of Dev you are using.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using version 4.9.8.1. What I am trying to do is compile a #include file for my main program. This file is a series of function and it has a #include for my class file.h. I get only one error
[Linker error] undefined reference to "WinMain@16"
this file has no main or WinMain function
I decided to try another project so I built a completely different console file. the file is an empty file built on the standard Dev-C++ template I added a #include with a simple class definition.
when I try to compile the cpp file I get the same error. I believe the error has to do with my Dev-C++ configuration not the files I am working with.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I asked for 3 things, you posted 1. In terms of hunting configuration errors, that is why I posted request number 2, for you to post your >>FULL<< compile log >>NOT<< just the error. The full log shows me how the compiler was invoked, what your paths are, heck, even where the compiler is installed. Use the right mouse button to bring up the copy menu and copy and paste into your next post. It may not solve your problem, but it can eliminate some very common potential issues..
Please provide an explicit, simple example that shows the effect you are seeing, and your complete compile log. That is a good starting point...
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a file that I am trying to include in a program. I can compile fine on a Unix system but when trying to complile with Dev-C++ I get the following error. This is the only error but I have no idea what is causing it. Any help would be greatly appreciated
[Linker error] undefined reference to "WinMain@16"]
The file I am trying to compile is just a series of functions
Please look at the FAQ before you ask a question:
http://www.bloodshed.net/dev/faq.html#winmain
What has happened most times is that you are writing a console apllication (which is consistent from having been on Unix before), but when you started your project, you chose to start a windows project, which, instead of a main function, requires a winmain function. If this is the case, start over with a console project...
Wayne
I hadn't looked at the FAQs but before I posted here my first thought was exactly what you posted Mr. Keen thanks I appreciate the reply.
I started a new console project and then entered the code from my original file. It still will not compile.
The main exe compiles fine as long as the #include is commented out. I have built several other console applications and not had this problem
The file I am having trouble with also has a #include which is a .h file that has my class definintion.
I have been using Dev-C++ for a few months and this is the first real problem I have run into.
"The main exe compiles fine as long as the #include is commented out"
Uhhh, what include would that be? You mentioned nothing about an include in your first post to the thread. I get the feeling you are continuing from another thread?
It would help a lot if you would:
(1) Provide a simple code example that shows the problem you are having...the simpler the better
(2) *Always* pos the full compile log that you get, do not just post the error.
(3) Always mention what version of Dev you are using.
Wayne
I am using version 4.9.8.1. What I am trying to do is compile a #include file for my main program. This file is a series of function and it has a #include for my class file.h. I get only one error
[Linker error] undefined reference to "WinMain@16"
this file has no main or WinMain function
I decided to try another project so I built a completely different console file. the file is an empty file built on the standard Dev-C++ template I added a #include with a simple class definition.
when I try to compile the cpp file I get the same error. I believe the error has to do with my Dev-C++ configuration not the files I am working with.
Well, I asked for 3 things, you posted 1. In terms of hunting configuration errors, that is why I posted request number 2, for you to post your >>FULL<< compile log >>NOT<< just the error. The full log shows me how the compiler was invoked, what your paths are, heck, even where the compiler is installed. Use the right mouse button to bring up the copy menu and copy and paste into your next post. It may not solve your problem, but it can eliminate some very common potential issues..
Please provide an explicit, simple example that shows the effect you are seeing, and your complete compile log. That is a good starting point...
Wayne