Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Compiling a module in MSVC

 
Post new topic   Reply to topic Printable version
 View previous topic  ASSS Wiki Post :: Post Generic event handler?  View next topic  
Author Message
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Wed Jan 19, 2011 11:23 am    Post subject: Compiling a module in MSVC Reply to topic Reply with quote

So I decided to try compiling a simple module in Microsoft Visual C++ for the fun of it, but while I have everything configured to compile in C and setup similarly as it should in Dev-C++ or Eclipse, I can't seem to get past the following errors and warnings:

Code: Show/Hide

1>------ Rebuild All started: Project: my-module, Configuration: Debug Win32 ------
1>  util.c
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(125): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(238) : see declaration of 'strdup'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(153): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(188) : see declaration of 'strncpy'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(212): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(231): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(110) : see declaration of 'strcat'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(233): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(110) : see declaration of 'strcat'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(476): error C2059: syntax error : 'type'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(481): error C2059: syntax error : 'type'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1158): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1160): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1288): warning C4133: 'function' : incompatible types - from 'const char *' to 'LPCWSTR'
1>  my-module.c
1>  Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


I can add '_CRT_SECURE_NO_WARNINGS' into the preprocessor definitions, but I'm still left with:
Code: Show/Hide
1>------ Rebuild All started: Project: my-module, Configuration: Debug Win32 ------
1>  util.c
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(125): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
1>          c:\program files\microsoft visual studio 10.0\vc\include\string.h(238) : see declaration of 'strdup'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(476): error C2059: syntax error : 'type'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(481): error C2059: syntax error : 'type'
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1158): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1160): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\my-username\documents\visual studio 2010\projects\my-module\my-module\util.c(1288): warning C4133: 'function' : incompatible types - from 'const char *' to 'LPCWSTR'
1>  my-module.c
1>  Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


Any ideas on how I can resolve this?
Back to top
View users profile Send private message Add User to Ignore List Send email
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Wed Jan 19, 2011 12:01 pm    Post subject: Reply to topic Reply with quote

I do not know which version of util.c you have, so this is a guess.
However last time I tried compiling an asss module with VS I had the issue that VS has no C99 support. Such as variable declarations intermingled with code.


Last edited by JoWie on Wed Jan 19, 2011 12:02 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Arnk Kilo Dylie
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Wed Jan 19, 2011 12:01 pm    Post subject: Reply to topic Reply with quote

...is that util.c YOUR util.c? That doesn't look like asss's, judging by the complete lack of anything similar around those line numbers.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Wed Jan 19, 2011 4:03 pm    Post subject: Reply to topic Reply with quote

Arnk Kilo Dylie wrote:
...is that util.c YOUR util.c? That doesn't look like asss's, judging by the complete lack of anything similar around those line numbers.

No, it's the same file as in /src/main/, I just duplicated the file, a habit I picked up from working with Eclipse. If I include it directly from asss' source directory the problems are still the same, just change the path names.
Back to top
View users profile Send private message Add User to Ignore List Send email
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Jan 19, 2011 4:08 pm    Post subject: Reply to topic Reply with quote

Care to tell us the version you're using, or better yet, share the offending lines? Only the errors seem relevant. The warnings look harmless.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Wed Jan 19, 2011 4:26 pm    Post subject: Reply to topic Reply with quote

And remember that MSVC differs when it comes to the standard library in ways that can break stuff if you assume a particular way of operation.

for example
Code: Show/Hide

char buf[4];
snprintf(buf, 4, "Abcd");

Results in {'A','b','c',0} in GCC and {'A','b','c','d'} in MSVC.
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Jan 19, 2011 5:04 pm    Post subject: Reply to topic Reply with quote

Is this why it suggests snprintf_s ? Would that function set the last char to 0?
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Hakaku
Server Help Squatter


Joined: Apr 07 2006
Posts: 299
Location: Canada
Offline

PostPosted: Wed Jan 19, 2011 5:27 pm    Post subject: Reply to topic Reply with quote

I'm using asss 1.4.4 (sorry, I forgot to mention that in my last post), and the lines where the two errors (error C2059: syntax error : 'type') occur are the following:

Quote:
Link * LLGetHead(LinkedList *lst)
{
return lst->start;
}

int LLIsEmpty(LinkedList *lst)
{
return lst->start == NULL;
}


(Lines 476 & 481 in 1.4.4, or 468 & 473 in 1.5.0rc2)
Back to top
View users profile Send private message Add User to Ignore List Send email
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Jan 19, 2011 6:19 pm    Post subject: Reply to topic Reply with quote

I don't see anything on those lines that could cause an error like that (and not cause an error in a hundred other places).
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Arnk Kilo Dylie
Seasoned Helper


Age:36
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Wed Jan 19, 2011 6:23 pm    Post subject: Reply to topic Reply with quote

What's the function above it, and where's the typedef for Link? The answers probably lie there.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Jan 30, 2011 11:46 am    Post subject: Reply to topic Reply with quote

I sometimes get the same error on Eclipse, by the way.

One of my module also started giving a 'multiple definitions of...' for EVERY function in util.c, unless I #include "util.c" in my <module>.c file. And if I do include it, I get errors at LLGetHead and LLIsEmpty, just like Hakaku.
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Jan 30, 2011 12:52 pm    Post subject: Reply to topic Reply with quote

You should never #include a .c file, regardless of circumstances, in asss or anywhere else.

If the linker is giving you errors about missing util.c functions, you should add util to your module's .mk file, alongside your other module c files.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 669 page(s) served in previous 5 minutes.

phpBB Created this page in 1.419920 seconds : 37 queries executed (97.6%): GZIP compression disabled