mfc >> compiling unix code - unexpected errors

by Peter » Fri, 24 Mar 2006 01:21:15 GMT

dear group,

i'm trying to compile code with visual C++ (visual studio 2003 dotnet). the
code compiles fine on unix; would like for it to compile on vc++.

first question:

first, is there a gettimeofday() function on windows? i was under the
impression that gettimeofday() is part of the POSIX specification and MS
windows is a POSIX compliant operating system. shouldn't the function exist
for vc++?



second question:

here's the top of my code:

#define N 10 // Dimension of the matrices
#define ITERATIONS 500 // Times to perform multiplication.

#include "stdafx.h"
#include "Timer.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
static void complain_and_die( void );
static int getInt( const int low, const int high );
static void fill_matrix( int m[][N] );
static void matrix_multiplication( const int a[][N],
const int b[][N], int result[][N] );


The definition of main follows. I get many errors:

error C3861: 'N': identifier not found, even with argument dependent lookup

The lines that the error occurs on are:

1. The prototypes at the top of the file (given above)
2. Whenever I use N in a function.

It looks like the preprocessor isn't even acknowledging N, even though it's
clearly defined at the top of the file.

I'm mystified. Help? :)

Thanks,
Pete


mfc >> compiling unix code - unexpected errors

by Ajay Kalra » Fri, 24 Mar 2006 01:25:34 GMT


#include "stdafx.h" should be the first line. Everything should follow
under it. That will get rid of some of your issues.

------
Ajay Kalra
XXXX@XXXXX.COM




mfc >> compiling unix code - unexpected errors

by Ajay Kalra » Fri, 24 Mar 2006 01:31:24 GMT

For getting time etc, use CTime::GetCurrentTime etc. Here is the link:

http://msdn2.microsoft.com/en-us/library/346d544z (VS.80).aspx

----
Ajay Kalra
XXXX@XXXXX.COM



compiling unix code - unexpected errors

by Peter Jay Salzman » Fri, 24 Mar 2006 01:47:46 GMT




Thank you!

I'm still curious about gettimeofday() -- it's defined in the POSIX standard,
and Microsoft Windows (I thought) was POSIX compliant.

Or am I wrong about that?

My code compiled without errors. Thank you, Ajay!

Pete


compiling unix code - unexpected errors

by Ajay Kalra » Fri, 24 Mar 2006 01:54:38 GMT

I dont know about gettimeofday in Win32. I did google on it and found
out that is not available on Win32 (which you already knew). I also
found some sample code some sample code that simulates it on Win32.
Just do google and take the code from there if you want to stick to
gettimeofday.

-----
Ajay Kalra
XXXX@XXXXX.COM



compiling unix code - unexpected errors

by Peter Jay Salzman » Fri, 24 Mar 2006 02:20:43 GMT




No, I'm fine with using GetCurrentTime().

I was just trying to reconcile my knowledge of what it means for an OS to be
POSIX compliant. Mere curiosity.

Thanks for all your help!
Pete


Similar Threads

1. Error An unexpected exception has been detected in native code outside the VM

Hi,

We have to use firefox in solaris. We are able to open de browser but 
when we put our url we have the next error, some guys can connect 
without problems

Any idea?



An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xFBEA4D00
Function=[Unknown. Nearest: dga_init_version+0x3D0]
Library=/usr/openwin/lib/libdga.so.1

Current Java thread:
         at sun.awt.X11SurfaceData.initIDs(Native Method)
         at sun.awt.X11SurfaceData.<clinit>(Unknown Source)
         at sun.awt.motif.MComponentPeer.initialize(Unknown Source)
         at sun.awt.motif.MComponentPeer.init(Unknown Source)
         at sun.awt.motif.MWindowPeer.init(Unknown Source)
         at sun.awt.motif.MFramePeer.<init>(Unknown Source)
         at sun.awt.motif.MEmbeddedFramePeer.<init>(Unknown Source)
         at sun.awt.motif.MToolkit.createEmbeddedFrame(Unknown Source)
         at sun.awt.motif.MEmbeddedFrame.<init>(Unknown Source)
         at 
sun.plugin.viewer.frame.MNetscapeEmbeddedFrame.<init>(Unknown Source)
         at sun.plugin.viewer.MNetscapePluginObject.createFrame(Unknown 
Source)
         at sun.plugin.viewer.MNetscapePluginObject.setWindow(Unknown 
Source)
         at sun.plugin.navig.motif.Plugin.doit(Unknown Source)
         at sun.plugin.navig.motif.Plugin.start(Unknown Source)

Dynamic libraries:
0x10000         java_vm
0xff350000      /lib/libthread.so.1
0xff390000      /lib/libdl.so.1
0xff200000      /lib/libc.so.1
0xff330000      /usr/platform/SUNW,Ultra-2/lib/libc_psr.so.1
0xfe000000      /usr/j2re1.4.2_08/lib/sparc/client/libjvm.so
0xff2e0000      /lib/libCrun.so.1
0xff1e0000      /lib/libsocket.so.1
0xff100000      /lib/libnsl.so.1
0xff0b0000      /lib/libm.so.1
0xff1c0000      /lib/libsched.so.1
0xff090000      /lib/libmp.so.2
0xff050000      /usr/j2re1.4.2_08/lib/sparc/native_threads/libhpi.so
0xff020000      /lib/nss_files.so.1
0xfe7c0000      /usr/j2re1.4.2_08/lib/sparc/libverify.so
0xfe780000      /usr/j2re1.4.2_08/lib/sparc/libjava.so
0xfe760000      /usr/j2re1.4.2_08/lib/sparc/libzip.so
0xf1600000      /usr/j2re1.4.2_08/lib/sparc/libawt.so
0xfe420000      /usr/j2re1.4.2_08/lib/sparc/libmlib_image.so
0xfbc90000      /usr/j2re1.4.2_08/lib/sparc/motif21/libmawt.so
0xf1380000      /lib/libXm.so.4
0xfdf90000      /lib/libXt.so.4
0xfc5d0000      /lib/libXext.so.0
0xfc7e0000      /usr/openwin/lib/libXtst.so.1
0xf1280000      /lib/libX11.so.4
0xfbfa0000      /usr/openwin/lib/libdps.so.5
0xfc5b0000      /lib/libSM.so.6
0xfbed0000      /lib/libICE.so.6
0xfbea0000      /usr/openwin/lib/libdga.so.1
0xfbdc0000      /usr/j2re1.4.2_08/lib/sparc/libjavaplugin_jni.so
0xfe4a0000      /lib/libintl.so.1
0xf1180000      /usr/j2re1.4.2_08/lib/sparc/libfontmanager.so
0xfbda0000      /usr/j2re1.4.2_08/lib/sparc/libsunwjdga.so

Heap at VM Abort:
Heap
  def new generation   total 2112K, used 1715K [0xf1800000, 0xf1a20000, 
0xf1f1000
0)
   eden space 2048K,  80% used [0xf1800000, 0xf199cfb0, 0xf1a00000)
   from space 64K, 100% used [0xf1a10000, 0xf1a20000, 0xf1a20000)
   to   space 64K,   0% used [0xf1a00000, 0xf1a00000, 0xf1a10000)
  tenured generation   total 1408K, used 422K [0xf1f10000, 0xf2070000, 
0xf5800000
)
    the space 1408K,  30% used [0xf1f10000, 0xf1f79b18, 0xf1f79c00, 
0xf2070000)
  compacting perm gen  total 4096K, used 3525K [0xf5800000, 0xf5c00000, 
0xf980000
0)
    the space 4096K,  86% used [0xf5800000, 0xf5b717e8, 0xf5b71800, 
0xf5c00000)

Local Time = Fri Jul 14 13:56:25 2006
Elapsed Time = 4
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_08-b03 mixed mode)
#
# An error report file has been saved as /tmp/hs_err_pid8477.log.
# Please refer to the file for further information.
#
INTERNAL ERROR on Browser End: SendRequest: Read of ack failed: 0

System error?:: Error 0

2. ERROR MESSAGE "syntax error near unexpected token `do "

3. new.h gets error c2062 type '__w64 unsigned int' unexpected when compiling in .NET 2003

Ivan Starr wrote:
> Hello, thanks for trying to help.
> 
> I am trying to compile and link a VC6 project in .NET 2003.  It compiles and
> links in VC6, but when I try to compile it in .NET, I get this error.  This
> is the first time I have gotten an error in one of the included files that
> makes up part of the language - new.h is located in the VC7\Include dir, I
> had nothing to do with ti's writing.
Ivan:

I don't know if this will help, but go to the project properties for the 
compiler, General, and disable "detect 64bit portability issues"

/steveA

-- 
Steve Alpert
my email Fgrir_Nycreg @ vqk.pbz is encrypted with ROT13 (www.rot13.org) 
and spaces

4. unexpected compile error w/ member function specialization of a template class

5. Error while executing compiled code on linux

I am using matlab compiler to compile the .m files to stand
alone executable and when I am trying to run these on linux
machine following error is being returned

error while loading shared libraries: libmwmclmcrrt.so.7.6:
cannot open shared object file: No such file or directory

6. when I compile the source code, I confront some errors - Linux

7. [PATCH -mm] Revoke core code: fix nommu arch compiling error bug

8. [PATCH -mm] Revoke core code: fix nommu arch compiling error bug - Linux