473,790 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ERROR: "undefined reference to `_WinMain@16'" when compiling in Cygwin

21 New Member
Hello there :)

I have been using Visual Studio on a program which I have just completed, however I need to have it compiling using a unix based compiler, when I try in cygwin, I get the following error:

undefined reference to `_WinMain@16'

I have tried searching for a workaround, although I am not a programming guru, and I find it difficult to comprehend the discussions on this topic :)

Any help is appreciated.
Sep 28 '07 #1
16 43732
Savage
1,764 Recognized Expert Top Contributor
Hello there :)

I have been using Visual Studio on a program which I have just completed, however I need to have it compiling using a unix based compiler, when I try in cygwin, I get the following error:

undefined reference to `_WinMain@16'

I have tried searching for a workaround, although I am not a programming guru, and I find it difficult to comprehend the discussions on this topic :)

Any help is appreciated.
Do you have WinMain in your project?

Savage
Sep 28 '07 #2
gpraghuram
1,275 Recognized Expert Top Contributor
Hello there :)

I have been using Visual Studio on a program which I have just completed, however I need to have it compiling using a unix based compiler, when I try in cygwin, I get the following error:

undefined reference to `_WinMain@16'

I have tried searching for a workaround, although I am not a programming guru, and I find it difficult to comprehend the discussions on this topic :)

Any help is appreciated.
Hi,
Does ur code have a main in it.
I think if u put a main it will be solved.
Thanks
Raghuram
Sep 28 '07 #3
Micko1
21 New Member
Hi,
Does ur code have a main in it.
I think if u put a main it will be solved.
Thanks
Raghuram
Thankyou for the replies.

yes it has a main function.
Sep 28 '07 #4
Micko1
21 New Member
The full error I am getting is:

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(lib cmain.o):: undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
make: *** [nurseryTest] Error 1
Sep 28 '07 #5
weaknessforcats
9,208 Recognized Expert Moderator Expert
You have created the wrong kind of project.

You have created a Windows application instead of a Console Application.

Do this:

1) Create a Win3e2 project
2) When the wizard appears DO NOT CLICK FINISH!
3) Instead, click Application Settings
4) Select Console Application and Empty Project
5) Now click finish

and off you go.
Sep 28 '07 #6
weaknessforcats
9,208 Recognized Expert Moderator Expert
Egad! I didn't see you were using Cygwin.

You still have an incorrect project setup

But my instructions were for Visual Studio.

Sorry.
Sep 28 '07 #7
Savage
1,764 Recognized Expert Top Contributor
Hello there :)

I have been using Visual Studio on a program which I have just completed, however I need to have it compiling using a unix based compiler, when I try in cygwin, I get the following error:

undefined reference to `_WinMain@16'

I have tried searching for a workaround, although I am not a programming guru, and I find it difficult to comprehend the discussions on this topic :)

Any help is appreciated.
Is your cygwin compiler of Dev-C++?

Savage
Sep 28 '07 #8
Micko1
21 New Member
Is your cygwin compiler of Dev-C++?

Savage
I am unsure what you mean?

It is just the regular Cygwin that you get off the website...

Basically I need this program to compile in a unix environment
Sep 29 '07 #9
RRick
463 Recognized Expert Contributor
Try adding -mwindows to your gcc compiler command.

Take a look at this link http://www.ee.adfa.edu .au/staff/hrp/webDesignHelp/cygwin-ug-net-nochunks.html#O V-EX-WIN for more info. Refer to section 4.1.2
Sep 29 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7772
by: Steven T. Hatton | last post by:
Scroll to the bottom and read the last part first. I've been trying very diligently to 'modularize' the code from TC++PL3E found here: http://www.research.att.com/~bs/matrix.c I keep getting what I believe are linker errors. For example: g++ -g -O2 -o rematrix cslice_iter.o main.o matrix.o rematrix.o slice_iter.o rematrix.o(.text+0x29b): In function `f(int, int)':
0
1304
by: howie | last post by:
I've upgraded a vb6 application to vb .net and am having an issue. whenever I try to set the recordset property of the VB6.adodc object in .net and run the application I get the error “object reference not set to an instance of an object” this is what the code looks like Dim lador_JLD As New ADODB.Recordset ls_sql = "execute sp_ShiftEditJobsDetail " Dim Gdf_cpv As Object
6
6244
by: mihailsmilev | last post by:
Hello, let me first describe the situation: I am developing an application using Qt Designer 3.3.5 on OpenSuSE Linux for my mp3 player. So I need to get the id3 tags from the mp3 files, and I've downloaded the sources of id3lib. I've included the headers (there are no other files) in my project in Qt designer, then created an object from my files. When starting the make command, it compiles normally all the headers (although giving some...
1
3217
by: Shuaib | last post by:
Hey! I am trying to embedd python into a C programe of mine. But when I try to compile the C code, gcc gives errors like "undefined reference to `Py_Finalize'" and the same kind for all the other functions. I have incuded "Python.h". Any idea what might be wrong? Thanks.
3
2056
by: s.z.s | last post by:
Hi! I hope the solution to that is not too stupid... I've got three files: <snip test_main.cc> #include"test.hh" int main(void) { A<inta1; a1.saywhat();
8
1947
by: Soneji | last post by:
Hello all! ( again ) Once more, I have a problem that seems unsolvable by me. I'm getting the, seemingly common, "undefined reference" linking error. I've tried quite a few things, but nothing is working. I'll list what I've tried at the end of my post. Until then, here's the error message, and the code ( Sorry...( length ) ) :
4
1713
by: steve | last post by:
Hi, I am trying to compile a sample program using gcc. The program requires headers so I put the header files and corresponding source files into one folder. Then I ran the command 'gcc prog.c -o prog.exe.' It then gives me errors such as "undefined reference to '_N_VNew'" where N_VNew is in the header files I put in the folder. Usually gcc file.c -o file.exe worked for a c program that include no user defined headers. I've never dealt...
1
2143
by: ashjas | last post by:
Hello, i am trying to compile a code(main.cpp) which uses a function that is declared in a header file that is within the directory where the main.cpp file resides so the header is included as #include"abc.h" that function's definition is inside abc.cpp that also resides in the directory of main.cpp i.e with abc.h but still on usage of that function i get "undefined reference to" that function error.... How is this possible??
8
6301
Motoma
by: Motoma | last post by:
Good evening everyone. I am starting to re-explore C++, and I wanted to build a singleton class. Unfortunately, when I set things up as I do in PHP, it doesn't work out for me. I hope that the problem is something small and obvious, but here is what I have: #include <iostream> using namespace std; class ClientManager {
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.