Jump to content
thoschmi

SystemC in Visual Studio 2012

Recommended Posts

Hi,

I'm trying to install SystemC on Microsoft Visual Studio 2012. I downloaded SystemC 2.3.0

and did the steps in this tutorial:

http://www.ict.kth.se/courses/IL2452/Sept2009/TUTORIAL-SystemC-with-Microsoft-Visual-Studio.pdf

I opened the C++ project in SystemC 2.3.0\...\msvc80 folder and tried to

build it, but i got the following errors:

1>------ Erstellen gestartet: Projekt: SystemC, Konfiguration: Debug Win32 ------

1> sc_list.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_reset.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_main_main.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_main.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_except.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_unsigned.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_signed.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_nbdefs.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_bit.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_signal_resolved_ports.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_signal_resolved.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> sc_port.cpp

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(195): warning C4005: 'for': Makro-Neudefinition

1> c:\users\thomas\downloads\systemc-2.3.0\systemc-2.3.0\src\sysc\kernel\sc_cmnhdr.h(75): Siehe vorherige Definition von 'for'

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xkeycheck.h(242): fatal error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.

1> Code wird generiert...

========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 ├╝bersprungen ==========

I hope someone could help me

Regards,

Thomas

Share this post


Link to post
Share on other sites

You need to disable the problematc redefinition of 'for' in src/sysc/kernel/sc_cmnhdr.h, which used to work around a bug in an ancient version of MSVC. See attached patch.

Greetings from Oldenburg,

Philipp

0001-Check-for-MSVC-version-in-for-scope-bug-hack.patch.txt

Share this post


Link to post
Share on other sites

Try:

1. Installed Visual C++ 2012 Express Edition

(Note - won't work on XP only Windows 7/8)

2. Download Systemc-2.3.0.tgz

3. uncompress systemc-2.3.0.tgz

4. Assuming in c:\systemc-2.3.0

5. copy msvc80 to msvc11

(optional, but helps if you attempt to run regressions)

6. Run Visual C++ 2012 EE and open

msvc11\systemc\systemc.sln

7. Upgrade is offered - click OK

8. Menu Build > Build Solution

Build failed due to warning 4005

Edit sc_cmnhdr.h line 75 and add a test for _MSC_VER == 1200 as follows:

// MSVC6.0 for() scope bug

#if defined(_MSC_VER) && (_MSC_VER == 1200)

#define for if( false ); else for

#endif

Now it should build.

9. Add an environment variable

SYSTEMC

set to

c:\systemc-2.3.0\

10. Set library, src, include paths as for Visual C++ 2010

Note: to find the property pages, load in a project (e.g. ex6 from the course).

Then do View > Other Windows > Property Manager

Expand the project name until you find

Debug | Win32 > Microsoft.CPP.Win32.user

and set the include and library directories to

$(SYSTEMC)\src

$(SYSTEMC)\msvc11\systemc\debug

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×