[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
undefined reference to `_WinMain@16' error!
From: |
jchiarelli |
Subject: |
undefined reference to `_WinMain@16' error! |
Date: |
Fri, 17 Apr 2009 16:14:52 -0400 |
Hi ,
I am on windows trying to compile some object-c code usign GNUstep.
I am getting the following eror:
$ make
This is gnustep-make 2.0.7. Type 'make print-gnustep-make-help' for help.
Making all for tool test...
Linking tool test ...
C:/GNUstep/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a(main.o):
main
.c:(.text+0xbd): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
make[1]: *** [obj/test.exe] Error 1
make: *** [test.all.tool.variables] Error 2
My make file is basic:
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = test
LogTest_OBJC_FILES = test.m
include $(GNUSTEP_MAKEFILES)/tool.make
For reference my code is:
#import <Foundation/Foundation.h>
// sample function for one section, use a similar function per section -
copied from assignment sheet
void PrintPathInfo() {
// Code from path info section here
NSLog(@"Enter PrintPathInfo");
NSString *aString = @"My Home Folder is at:";
NSString *path = @"~";
path = [path stringByExpandingTildeInPath];
NSLog([aString stringByAppendingString: path]);
NSInteger i = 0;
NSArray *pathComponents = [path pathComponents];
for (NSString *element in pathComponents) {
NSLog(@"element %d: %@", i, element);
i++;
}
NSLog(@"======================================================Path=>");
}
void PrintProcessInfo() {
// Code
NSLog(@"Enter PrintProcessInfo");
NSString *processName = [[NSProcessInfo processInfo] processName];
// NSLog(processName);
NSInteger processID = [[NSProcessInfo processInfo] processIdentifier];
// NSLog( @"%i", processID);
NSLog(@"Process Name: %@ Process ID: %d ", processName, processID);
NSLog(@"===================================================Process=>");
}
void PrintBookmarkInfo() {
// Code
NSLog(@"Enter PrintBookmarkInfo");
NSMutableDictionary *bkmks = [NSMutableDictionary
dictionaryWithCapacity:10];
// NSURL *site = [ NSURL URLWithString: @"www.stanford.edu"];
[ bkmks setObject:[ NSURL URLWithString: @"www.stanford.edu"]
forKey:@"Stanford University"];
[ bkmks setObject:[ NSURL URLWithString: @"www.apple.com"]
forKey:@"Apple"];
[ bkmks setObject:[ NSURL URLWithString: @"cs193p.stanford.edu"]
forKey:@"CS193P"];
[ bkmks setObject:[ NSURL URLWithString: @"itunes.stanford.edu"]
forKey:@"Stanford on iTunes U"];
[ bkmks setObject:[ NSURL URLWithString: @"stanfordshop.com"]
forKey:@"Stanford Mall"];
for (id key in bkmks) {
if ([key hasPrefix:@"Stanford"])
NSLog(@"Key: '%@', URL: '%@'", key, [bkmks objectForKey:key]);
}
NSLog(@"=======================================================Web=>");
}
void PrintIntrospectionInfo() {
// Code
NSLog(@"Enter PrintIntrospectionInfo");
NSString *path = @"~";
path = [path stringByExpandingTildeInPath];
NSArray *pathComponents = [path pathComponents];
NSString *processName = [[NSProcessInfo processInfo] processName];
// NSInteger processID = [[NSProcessInfo processInfo] processIdentifier];
NSURL *site = [ NSURL URLWithString: @"www.stanford.edu"];
NSMutableDictionary *bkmks = [NSMutableDictionary
dictionaryWithCapacity:10];
NSMutableString *mstring1 = @"Mutable1";
NSMutableString *mstring2 = @"THIS WAS ALL CAPS";
NSMutableArray *marray = [NSMutableArray arrayWithCapacity:10];
[marray addObject:path];
[marray addObject:pathComponents];
[marray addObject:processName];
// adding NSInteger to mutable array causes warning that it is being
changed to a pointer (??)
// [marray addObject:processID];
[marray addObject:site];
[marray addObject:bkmks];
[marray addObject:mstring1];
[marray addObject:mstring2];
// NSLog(@" %@", marray);
NSUInteger limit = [marray count];
NSUInteger i = 0;
SEL sel = @selector(lowercaseString);
for (i=0 ; i < limit ; i++) {
NSLog(@"============================");
NSLog(@"Class Name:%@ ", [[marray objectAtIndex:(unsigned)i] className]);
NSLog(@"Is Member of NSString:%@ ", ([[marray objectAtIndex:(unsigned)i]
isMemberOfClass:[NSString class]] ? @"YES" : @"NO"));
NSLog(@"Is Kind of NSString:%@ ", ([[marray objectAtIndex:(unsigned)i]
isKindOfClass:[NSString class]] ? @"YES" : @"NO" ));
// NSLog(@" sel: %@", sel);
if ([[marray objectAtIndex:(unsigned)i] respondsToSelector:sel])
{
NSLog(@"Responds to lowercaseString: YES");
NSLog(@"lowercaseString is: %@", [[marray objectAtIndex:(unsigned)i]
performSelector:sel withObject:[marray objectAtIndex:(unsigned)i] ]);
} else
NSLog(@"Responds to lowercaseString: NO");
}
NSLog(@"=====================================================Intro=>");
}
//
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/
NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/doc/uid/2000005
1-SW5
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"================WhatATool(Part 1)===========================");
//code for cs193p
PrintPathInfo(); // Section 1
PrintProcessInfo(); // Section 2
PrintBookmarkInfo(); // Section 3
PrintIntrospectionInfo(); // Section 4
NSLog(@"=====================END====================================");
[pool drain]; //drain or release?? I think drain - see above document
return 0;
}
Thanks Joe
- undefined reference to `_WinMain@16' error!,
jchiarelli <=