Can someone make this VS 2010?

Started by
11 comments, last by Bacterius 10 years, 4 months ago

so why do you think i asked in the first post for help...? maybe because i got stuck in the hurdles of mingw? Then i had 2 posts suggesting me to use visual studio,which I did...

Advertisement

Ok...now I really got stuck....

There are so many defines that it says it can't find but they are included...

And the void pointers...they should be cast into something since c++ is more restrictive...but cast them into what?!


1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>  util.c
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(100): warning C4133: 'function' : incompatible types - from 'time_t *' to 'tm *'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(100): error C2198: 'localtime_s' : too few arguments for call
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(100): warning C4047: '=' : 'tm *' differs in levels of indirection from 'errno_t'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(150): error C2036: 'void *' : unknown size
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(151): error C2036: 'void *' : unknown size
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(162): warning C4018: '>' : signed/unsigned mismatch
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(166): error C2036: 'const void *' : unknown size
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(180): warning C4244: '=' : conversion from 'curl_off_t' to 'size_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(183): warning C4244: '+=' : conversion from 'curl_off_t' to 'size_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(186): warning C4244: '=' : conversion from 'curl_off_t' to 'size_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(211): error C2036: 'void *' : unknown size
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(217): error C2036: 'void *' : unknown size
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(232): warning C4013: 'strcasecmp' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(362): error C2146: syntax error : missing ')' before identifier 'PACKAGE_NAME'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(362): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(380): warning C4013: 'strncasecmp' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(456): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(563): warning C4244: '=' : conversion from 'double' to 'uint64_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(849): error C2146: syntax error : missing ')' before identifier 'PACKAGE_NAME'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(849): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(851): error C2146: syntax error : missing ')' before identifier 'PACKAGE_NAME'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(851): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(896): warning C4244: '=' : conversion from 'json_int_t' to 'int', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1092): warning C4244: '=' : conversion from 'json_int_t' to 'int', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1119): error C2065: 'PACKAGE_NAME' : undeclared identifier
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1119): warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1119): warning C4024: 'json_string' : different types for formal and actual parameter 1
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1119): error C2143: syntax error : missing ')' before 'string'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1222): warning C4013: 'typeof' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1222): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1222): warning C4552: '!=' : operator has no effect; expected operator with side-effect
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1227): error C2143: syntax error : missing ')' before '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1227): error C2143: syntax error : missing '{' before '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1227): error C2059: syntax error : '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1227): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1228): error C2143: syntax error : missing ')' before '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1228): error C2143: syntax error : missing '{' before '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1228): error C2059: syntax error : '&'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1228): error C2059: syntax error : ')'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1230): error C2059: syntax error : ','
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1230): error C2143: syntax error : missing ')' before 'constant'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1230): error C2143: syntax error : missing '{' before 'constant'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1230): error C2059: syntax error : 'constant'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1231): error C2371: 'free' : redefinition; different basic types
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\stdlib.h(641) : see declaration of 'free'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1232): error C2059: syntax error : '}'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\util.c(1246): warning C4013: 'tq_freezethaw' undefined; assuming extern returning int
1>  sha2.c
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(587): error C2146: syntax error : missing ';' before identifier '__attribute__'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(587): warning C4013: '__attribute__' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(587): warning C4013: 'aligned' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(588): error C2146: syntax error : missing ';' before identifier '__attribute__'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(589): error C2146: syntax error : missing ';' before identifier '__attribute__'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\sha2.c(590): error C2146: syntax error : missing ';' before identifier '__attribute__'
1>  scrypt.c
1>  cpu-miner.c
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(315): error C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\stdio.h(356) : see declaration of 'sprintf'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(409): warning C4013: 'gettimeofday' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(555): warning C4244: 'function' : conversion from 'time_t' to 'uint32_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(636): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(743): warning C4244: '*=' : conversion from 'double' to 'int64_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(749): warning C4244: '=' : conversion from 'int64_t' to 'uint32_t', possible loss of data
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1002): error C2065: 'PACKAGE_STRING' : undeclared identifier
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1100): warning C4013: 'strncasecmp' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1230): warning C4013: 'getopt' undefined; assuming extern returning int
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1235): error C2065: 'optarg' : undeclared identifier
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1235): warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1235): warning C4024: 'parse_arg' : different types for formal and actual parameter 2
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1237): error C2065: 'optind' : undeclared identifier
1>c:\users\enjoydrama\documents\visual studio 2013\projects\test\test\cpu-miner.c(1239): error C2065: 'optind' : undeclared identifier
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So, this is not a C++ library but a C library. I believe there is a project setting in visual studio that allows you to 'compile as C'.

-Josh

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet


So, this is not a C++ library but a C library. I believe there is a project setting in visual studio that allows you to 'compile as C'.

-Josh

Yes, it's /Tc (compared to /Tp for C++). Still, if the library was written in C, designed for GCC, and not written with portability to other compilers in mind, it's likely going to suck big time porting it over to MSVC. More cost-effective to just use mingw IMHO. It takes some setting up but once it works it behaves pretty much the same as if you were on Linux.

The bottom line is, C was designed to be portable, but it was determined shortly after that a C program using only the standard libraries was not always very useful. And not everyone ended up using cross-platform libraries to do the stuff not covered by the standard library. And if that is not the case, you are looking at either using an emulation layer (e.g. cygwin or mingw) or at a complete rewrite of all the parts that aren't offered by visual studio.

To start with, the assembly files (which are pretty much the heart of the cpuminer project) are a complete non-starter on MSVC. It cannot deal with them. You need to install NASM (or another assembler), convert these assembly files to NASM format (which doesn't look too hard in this situation, though) and then set up a custom build rule in Visual Studio to send those .S files to NASM, otherwise it will just ignore them. Or, of course, you could just use mingw, which handles it out of the box.

So overall it's up to you - do you want to jump through the hoops to make the code work using Microsoft's compiler (which may or may not even be possible in a reasonable timescale), or do you prefer to use the recommended and tested compiler and following the instructions on the project's readme file, and asking more specific questions if you get stuck on any of these steps?

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

This topic is closed to new replies.

Advertisement