yosri ben salah Posted July 9, 2017 Report Share Posted July 9, 2017 Hi all , pls who can expain to me the reson of this warning even my code is too simple warning C4407: cast impossible between different representation of pointer , lthe complier may generate a wrong code #ifndef ALARM_H_ #define ALARM_H_ #include <systemc> #include <iostream> SC_MODULE(Alarm) { sc_core::sc_in<bool> i; SC_CTOR(Alarm) : i("i") { SC_METHOD(AlarmMethod); sensitive << i.pos(); dont_initialize(); } void AlarmMethod(); }; // Alarm #endif // ALARM_H_ ---------------------------------------------------------- #include "alarm.h" void Alarm::AlarmMethod() { bool temp = i.read(); std::cout << sc_core::sc_time_stamp() <<std::boolalpha << " i: " << temp << std::endl; } ------------ #include "detect.h" void Detect::DetectThread() { // Open CV setup // required only once. while(1) { // Call OpenCV motion detection // Compare with threshold // if greater then write true // else // false if (!s) { s = true; } else { s = false; } std::cout <<sc_core::sc_time_stamp() << std::boolalpha << " s: " << s << std::endl; o.write(s); wait(50, sc_core::SC_MS); } } ------------------------------------------------ #include "top.h" int sc_main(int argc, char **argv) { Top t("t"); sc_core::sc_start(1000, sc_core::SC_MS); sc_core::sc_stop(); return 0; } Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted July 9, 2017 Report Share Posted July 9, 2017 detect.h source code is not included, so I can't compile this. Quote Link to comment Share on other sites More sharing options...
yosri ben salah Posted July 9, 2017 Author Report Share Posted July 9, 2017 ------------------------------------------------- #ifndef DETECT_H_ #define DETECT_H_ #include <systemc> #include <iostream> SC_MODULE(Detect) { sc_core::sc_out<bool> o; SC_CTOR(Detect) : o("o") // , s(false) { SC_THREAD(DetectThread); } void DetectThread(); private: bool s; }; // Detect #endif // DETECT_H_ ---------------------------------------------------------- #ifndef TOP_H_ #define TOP_H_ #include <systemc> #include <iostream> #include "alarm.h" #include "detect.h" SC_MODULE(Top) { sc_core::sc_signal<bool> sig; Detect d; Alarm a; SC_CTOR(Top) : sig("sig") , d("d") , a("a") { d.o(sig); a.i(sig); } }; // Top #endif // TOP_H_ Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted July 9, 2017 Report Share Posted July 9, 2017 Class Top is not declared/defined Quote Link to comment Share on other sites More sharing options...
yosri ben salah Posted July 9, 2017 Author Report Share Posted July 9, 2017 yes you are right , i edited my response Roman Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted July 9, 2017 Report Share Posted July 9, 2017 Compiles without any warnings in G++4.8. Quote Link to comment Share on other sites More sharing options...
yosri ben salah Posted July 9, 2017 Author Report Share Posted July 9, 2017 the problem that it also compiles in my visual studio environnement for a week, but now when i tried to debug it runs warning, and memory exception when debuguing Quote Link to comment Share on other sites More sharing options...
yosri ben salah Posted July 9, 2017 Author Report Share Posted July 9, 2017 Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted July 9, 2017 Report Share Posted July 9, 2017 Runs without any issues on Linux: 0 s s: true 0 s i: true 50 ms s: false ... 950 ms s: false Unfortunately I have no Windows machine near me to check with MSVC. Quote Link to comment Share on other sites More sharing options...
yosri ben salah Posted July 9, 2017 Author Report Share Posted July 9, 2017 thank you for your support Roman. it possible that the warning due to systemC configuration in MSVC. i will try to fix it but pls when you have windows machine try to compile it thank you Roman Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted July 10, 2017 Report Share Posted July 10, 2017 The error message is an indication, that you might miss the /vmg switch in your the MSVC project. Quoting from the SystemC INSTALL file (emphasis mine): Quote Creating SystemC Applications ----------------------------- 1. Start Visual Studio. From the Start Page select New Project and Win32 Console Project. Type the project name and select a suitable location then click OK. 2. Select the Application Settings page of the Win32 Application Wizard and make sure the 'Empty project' box is ticked. Click 'Finish' to complete the wizard. 3. Add new/existing C++ files to the project and edit code. 4. Display the project Property Pages by selecting 'Properties...' from the Project menu. 5. From the C/C++ tab, select the Language properties and set 'Enable Run-Time Type Info' to Yes 6. From the C/C++ tab, select the Command Line properties and add /vmg to the 'Additional Options:' box. 7. From the Linker tab, select the Input properties and type 'systemc.lib' in the 'Additional Dependencies' box. 8. Click OK (... more information follows) Hope that helps, Philipp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.