siebeneicher / webgl-loader

Automatically exported from code.google.com/p/webgl-loader
0 stars 0 forks source link

objcompress.cc doesn't compile #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I tried MinGW on Windows (4.5.2) and default GCC version that came on Ubuntu 
11.10 (4.6.1). 

Both complained about "strpbrk" and "strncmp" not being declared. 

For example here:

base.h:77:39: error: 'strpbrk' was not declared in this scope
mesh.h:425:46: error: 'strncmp' was not declared in this scope

MinGW additionally complains about unknown "z" format in printf.

For example here:

mesh.h:513:65: warning: unknown conversion type character 'z' in format
objcompress.cc:120:20: warning: unknown conversion type character 'z' in format

What is a preferred way to build objcompress executable on Windows / Linux?

Original issue reported on code.google.com by postfil...@gmail.com on 27 Oct 2011 at 3:36

GoogleCodeExporter commented 9 years ago
Well, it builds in my Linux box (Ubuntu GCC 4.2 and 4.4), but maybe I was 
sloppy in the includes.

I'll have to take a look at what a good %zu replacement is for MinGW. Maybe 
this is what I get for using size_t all over. :(

I'll take care of this soon, although it will take time to get these 
configurations to repro.

Original comment by wonchun on 27 Oct 2011 at 4:27

GoogleCodeExporter commented 9 years ago
Thanks. 

For %z I don't know if it's correct, but for some old version of objcompress, I 
got it to compile on MinGW like this:

fprintf(stderr, "num_verts: %lu", (unsigned long)num_verts);

void DumpDebug() const {

    printf("positions size: %lu\ntexcoords size: %lu\nnormals size: %lu"
           "\nfaces size: %lu\n", (unsigned long)positions_.size(), 
            (unsigned long)texcoords_.size(), (unsigned long)normals_.size(),
            (unsigned long)faces_.size());

}

Original comment by postfil...@gmail.com on 27 Oct 2011 at 5:26

GoogleCodeExporter commented 9 years ago
If you add:

#include <string.h>

to base.h, it compiles.

Original comment by jterr...@gmail.com on 2 Dec 2011 at 8:30

GoogleCodeExporter commented 9 years ago
Some fixes in r73. I added the missing #include <string.h> but I didn't change 
the %z stuff yet (although, I guess I'm surprised that it would cause an issue).

BTW, there's a more major refactoring in the works that will make many needed 
cleanups.

Original comment by wonchun on 20 Dec 2011 at 7:52

GoogleCodeExporter commented 9 years ago
Issue 28 has been merged into this issue.

Original comment by wonchun on 9 Apr 2012 at 10:39

GoogleCodeExporter commented 9 years ago
r82 should fix this, but I don't have access to MSVC to verify. I can do MinGW, 
but probably not for a while.

Original comment by wonchun on 9 Apr 2012 at 10:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
MinGW works for objcompress but not objanalyze. Here are the errors:

objanalyze.cc: In function 'int main(int, const char**)':
objanalyze.cc:88:7: error: 'class WavefrontObjFile' has no member named 
'CreateDrawMeshes'
objanalyze.cc:106:72: error: invalid initialization of reference of type 'const 
BoundsParams&' from
expression of type 'BoundsParams*'
mesh.h:807:6: error: in passing argument 2 of 'void 
AttribsToQuantizedAttribs(const AttribList&, con
st BoundsParams&, QuantizedAttribList*)'
objanalyze.cc:107:62: error: no matching function for call to 
'VertexOptimizer::VertexOptimizer(Quan
tizedAttribList&, IndexList&)'
objanalyze.cc:107:62: note: candidates are:
optimize.h:38:3: note: VertexOptimizer::VertexOptimizer(const 
QuantizedAttribList&)
optimize.h:38:3: note:   candidate expects 1 argument, 2 provided
optimize.h:30:7: note: VertexOptimizer::VertexOptimizer(const VertexOptimizer&)
optimize.h:30:7: note:   candidate expects 1 argument, 2 provided
objanalyze.cc:109:20: error: 'class VertexOptimizer' has no member named 
'GetOptimizedMeshes'

Attached is the BAT file I used to compile using MinGW.

MSVC won't compile until Issue 30 is addressed.

Original comment by j...@coderforlife.com on 9 Apr 2012 at 11:04

Attachments:

GoogleCodeExporter commented 9 years ago
Yeah, objanalyze is totally broken. Do you need it for anything? I could easily 
get it working again.

Duly noted w.r.t. Issue 30. I'll have to find an MSVC setup, but I can start by 
applying your suggested changes.

Original comment by wonchun on 9 Apr 2012 at 11:41

GoogleCodeExporter commented 9 years ago
Okay about objanalyze. I don't need it, just wanted to report the Windows build 
errors.

For now I can do MSVC builds for you. Having MinGW working though is great 
since now Windows builds are possible. MSVC would be nice since it is much 
easier to do debugging and whatnot. If you have a Windows box you can get 
MSVC++2010 Express for free 
(http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-e
xpress).

Original comment by j...@coderforlife.com on 9 Apr 2012 at 11:47