Logo by Pauldelbrot - Contribute your own Logo!
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. September 25, 2017, 05:15:17 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Compiling on VS2010 C++ Express  (Read 3932 times)
0 Members and 1 Guest are viewing this topic.
ker2x
Fractal Molossus
**
Posts: 776


WWW
« on: May 14, 2010, 11:08:52 PM »

I successfully compiled mandelbulber on win7 using Code::Block

Now i'm trying with VS2010 C++ Express
Here come troubles, of course   embarrass

I'm a newbie with VStudio stuff  huh?

The first problem was 'M_PI' : undeclared identifier"
Easily solved by adding #define _USE_MATH_DEFINES before every include of math.h

A thread on microsoft connect suggest : to define _USE_MATH_DEFINES in ProjectProperties/C++/Preprocessor but i didn't tried.
Additionally : some warning about performance problem, unsafe function, nothing big.

Anyway... that was, by far, the easiest problem.

The first error :
Code:
settings.cpp(455): fatal error C1061: compiler limit : blocks nested too deeply
from msdn : Nesting of code blocks exceeds the limit of 128 nesting levels. Simplify nesting.

i simply remplaced the 127th "else if" with a "if", no more "deep nesting" (i didn't knew that a lot of "else if" were "nested blocks" ...)

Next problem :

Code:
1>image.cpp(529): error C2057: expected constant expression
1>image.cpp(529): error C2466: cannot allocate an array of constant size 0
1>image.cpp(529): error C2133: 'Thread' : unknown size
1>image.cpp(530): error C2057: expected constant expression
1>image.cpp(530): error C2466: cannot allocate an array of constant size 0
1>image.cpp(530): error C2133: 'err' : unknown size
1>image.cpp(532): error C2057: expected constant expression
1>image.cpp(532): error C2466: cannot allocate an array of constant size 0
1>image.cpp(532): error C2133: 'thread_param' : unknown size

There exact error is : int NR_THREADS Error: expression must have a constant value

As a workaround, i defined int const NR_THREADS = 2;
and removed : NR_THREADS = get_cpu_count();
But i don't have a good solution

Code:
1>Render3D.cpp(936): error C3861: 'chdir': identifier not found

remplaced by _chdir and included direct.h

i also had to remove unistd.h (don't exist on windows)

1>image.cpp(372): error C2668: 'sqrt' : ambiguous call to overloaded function

There are two pow/sqrt functions, one that takes a float and returns a float, and one that takes a double and returns a double.
So i modified the program that way : double r = sqrt(double(dx * dx + dy * dy));


Now it compile... but doesn't link, with tons of undefined reference to gtk stuff. probably just a project setting problem (hopefully) smiley

There is a lot of win32 coder here.
Can someone help me to solve all thoses problems in a clean way ? (so buddy could include all the modifications in the original software and still keep it multiplatform)

thank you smiley
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
ker2x
Fractal Molossus
**
Posts: 776


WWW
« Reply #1 on: May 14, 2010, 11:27:57 PM »

about the linking problem, i just added :
glib-2.0.lib
pangocairo-1.0.lib
pangowin32-1.0.lib
atk-1.0.lib
gdk_pixbuf-2.0.lib
gdk-win32-2.0.lib
pango-1.0.lib
gmodule-2.0.lib
gobject-2.0.lib
gthread-2.0.lib
gtk-win32-2.0.lib
cairo.lib
jpeg.lib

Next and last problem known :

Quote
1>  Generating Code...
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
1>fractal.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>image.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>interface.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>Render3D.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>settings.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>shaders.obj : error LNK2005: "int const NR_THREADS" (?NR_THREADS@@3HB) already defined in callbacks.obj
1>C:\Users\vbox\Desktop\CS2010-Mandelbulber-win32-0.50 - Copie\src\Release\mandelbulber.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

i don't know what to do sad   cry
« Last Edit: May 14, 2010, 11:30:53 PM by ker2x » Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
ker2x
Fractal Molossus
**
Posts: 776


WWW
« Reply #2 on: May 15, 2010, 12:00:46 AM »

You know what ? forget about VisualStudio.
It works with CodeBlocks and that's good enough  cheesy
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
cbuchner1
Fractal Phenom
******
Posts: 443


« Reply #3 on: May 15, 2010, 02:50:31 PM »

You know what ? forget about VisualStudio.
It works with CodeBlocks and that's good enough  cheesy

I suspect your NR_THREADS hack was done in a header file which got included from multiple .cpp files - so an instance of NR_THREADS was created in each .obj file - resulting in a collision during the linking phase
Logged
knighty
Fractal Iambus
***
Posts: 818


« Reply #4 on: May 15, 2010, 03:08:35 PM »

Maybe NR_THREADS should be declared with 'extern' statment in the header file and declared (to be actually allocated) once in one of the c,cpp files. Someting like this in the header:
extern int NR_THREADS;
Logged
Buddhi
Fractal Iambus
***
Posts: 885



WWW
« Reply #5 on: May 16, 2010, 10:58:56 AM »

Code:
There exact error is : int NR_THREADS Error: expression must have a constant value

As a workaround, i defined int const NR_THREADS = 2;
and removed : NR_THREADS = get_cpu_count();
But i don't have a good solution

GCC compilator allows to use array declaration with not constant value. I used:
Code:
GThread *Thread[NR_THREADS + 1];
GError *err[NR_THREADS + 1];

For VisualStudio should be changed to:
Code:
GThread **Thread = new GThread*[NR_THREADS + 1];
GError **err = new GError*[NR_THREADS + 1];

Maybe NR_THREADS should be declared with 'extern' statment in the header file and declared (to be actually allocated) once in one of the c,cpp files. Someting like this in the header:
extern int NR_THREADS;
Now there is in Render3D.h:
Code:
extern int NR_THREADS;
and in Render3D:
Code:
int NR_THREADS;
It should be enough. All files which use NR_THREADS value have to include Render3D.h file.

Code:
There is a lot of win32 coder here.
Can someone help me to solve all thoses problems in a clean way ? (so buddy could include all the modifications in the original software and still keep it multiplatform)
This source code is already multi-platform but VisualC++ is completely different than GCC family compilers. To compile this program on Windows you should use MiniGW environment or Cygwin.
Logged

ker2x
Fractal Molossus
**
Posts: 776


WWW
« Reply #6 on: May 17, 2010, 09:44:59 AM »

This source code is already multi-platform but VisualC++ is completely different than GCC family compilers. To compile this program on Windows you should use MiniGW environment or Cygwin.

yup  grin
I wanted to make it compilable on both MinGW and MS VS2010, but i realize that it's a pain in the *bleep*, my bad   sad
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Drawing pixels in Visual studio express? Programming Yesiamjames 3 2078 Last post October 06, 2011, 05:13:35 PM
by zenzero-2001
Compiling Animation? Mandelbulber atemporal 6 2171 Last post October 11, 2012, 03:37:30 AM
by JohnVV
problems compiling on linux Fragmentarium TruthSerum 5 654 Last post June 04, 2015, 04:13:45 AM
by 3dickulus
PCI Express CPU CoProcessors Help & Support garygerber 3 509 Last post August 03, 2015, 05:38:45 PM
by garygerber
Error when compiling mandelbulber2-2.10 on debian jessie Mandelbulber freakiebeat 3 421 Last post April 13, 2017, 12:40:20 PM
by freakiebeat

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.481 seconds with 28 queries. (Pretty URLs adds 0.012s, 2q)