Меню

Ошибка e0304 visual studio

DisplayMap.insert(i, map[i]);

As you can see in the above sample, I’ve tried to use the insert function, but it keeps displaying the same E0304 Error, which is for an overloaded function. In VS2019, the error details are:

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0304   no instance of overloaded function "std::basic_string<_Elem, _Traits, _Alloc>::insert [with _Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>]" matches the argument list

The error says that the arguments don’t match because the different overloads have different arguments.
Can you help me solve this error?
Here’s my full code if you need it:

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <algorithm>
#include <string>
#include "Data.h"
using namespace std;

int main() {
    SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0);
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    int WindowColumns, WindowRows, DisplayBuffer;
    string DisplayMap;
    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
    WindowColumns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
    WindowRows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
    cout << WindowColumns << "," << WindowRows;
    DisplayBuffer = WindowColumns * WindowRows;
    for (int i = 0; i < WindowColumns; i++) {
        DisplayMap.insert(i, map[i]);
    }
    return 0;
}

Thanks In advance.

EDIT:
Data.h here:

#pragma once

#include <iostream>
#include <String>
using namespace std;
string savedMap = "                              "
"                              "
"                              "
"                              "
"                              ";
string map = savedMap;
int w = 119, a = 97, s = 115, d = 100;
char key_press;
int myPOS = 35;
int MDPOS = myPOS, ascii_value;

Please don’t ask me why I use the namespace std in a header file.

DisplayMap.insert(i, map[i]);

As you can see in the above sample, I’ve tried to use the insert function, but it keeps displaying the same E0304 Error, which is for an overloaded function. In VS2019, the error details are:

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0304   no instance of overloaded function "std::basic_string<_Elem, _Traits, _Alloc>::insert [with _Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>]" matches the argument list

The error says that the arguments don’t match because the different overloads have different arguments.
Can you help me solve this error?
Here’s my full code if you need it:

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <Windows.h>
#include <conio.h>
#include <algorithm>
#include <string>
#include "Data.h"
using namespace std;

int main() {
    SetConsoleDisplayMode(GetStdHandle(STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0);
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    int WindowColumns, WindowRows, DisplayBuffer;
    string DisplayMap;
    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
    WindowColumns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
    WindowRows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
    cout << WindowColumns << "," << WindowRows;
    DisplayBuffer = WindowColumns * WindowRows;
    for (int i = 0; i < WindowColumns; i++) {
        DisplayMap.insert(i, map[i]);
    }
    return 0;
}

Thanks In advance.

EDIT:
Data.h here:

#pragma once

#include <iostream>
#include <String>
using namespace std;
string savedMap = "                              "
"                              "
"                              "
"                              "
"                              ";
string map = savedMap;
int w = 119, a = 97, s = 115, d = 100;
char key_press;
int myPOS = 35;
int MDPOS = myPOS, ascii_value;

Please don’t ask me why I use the namespace std in a header file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include <iomanip>
#include <functional>
#include <vector>
#include <boost/multiprecision/cpp_bin_float.hpp>
 
using namespace boost::multiprecision;
using namespace std;
 
typedef number<cpp_bin_float<200>> cpp_dec_float_unlim;
 
#define double cpp_dec_float_unlim
 
double dy0dt(const double& t, const double& y_0, const double& y_1, const double& y_2, const double& y_3, double& alpha) {
   return double(8.85e4) - y_2*y_0*((double(0.2) - y_0) / (double(1.) - y_1)) + y_0 / double(1e-8);
}
 
double dy1dt(const double& t, const double& y_0, const double& y_1, const double& y_2, const double& y_3, double& alpha) {
   return y_0 * y_2;
}
 
double dy2dt(const double& t, const double& y_0, const double& y_1, const double& y_2, const double& y_3, double& alpha) {
    return y_0 * y_3;
}
 
double dy3dt(const double& t, const double& y_0, const double& y_1, const double& y_2, const double& y_3, double& alpha) {
   return double(1e30)*sqrt(y_0)*exp(double(-alpha) / y_0);
}
 
struct my_data { 
 
    double t, y_0, y_1, y_2, y_3;
    my_data(double _t, double _y0, double _y1, double _y2, double _y3) : t(_t), y_0(_y0), y_1(_y1), y_2(_y2), y_3(_y3) {}
 
};
 
void rungeKutta( double y0, double y1, double y2, double y3, double t0, double max_t, double h, double alpha, std::vector<my_data>& result){
 
   double k1[4], k2[4], k3[4], k4[4];
 
   double t = t0;
 
   std::vector<std::function<double(double, double, double, double, double, double) >> vfunc;
   vfunc.push_back(dy0dt);
   vfunc.push_back(dy1dt);
   vfunc.push_back(dy2dt);
   vfunc.push_back(dy3dt);
 
   for (int i = 0; i < ((max_t - t0) / h); i++) {
 
      std::cout << t << "t" << std::setprecision(5) << y0 << "t" << y1 << "t" << y2 << "t" << y3 << std::endl;
 
      for (int j = 0; j < 4; ++j) {
         k1[j] = h*vfunc[j](t, y0, y1, y2, y3, alpha);
      }
 
      for (int j = 0; j < 4; ++j) {
         k2[j] = h*vfunc[j](t + double(0.5)*h, y0 + double(0.5)*k1[0], y1 + double(0.5)*k1[1], y2 + double(0.5)*k1[2], y3 + double(0.5)*k1[3], alpha);
      }
 
      for (int j = 0; j < 4; ++j) {
         k3[j] = h*vfunc[j](t + double(0.5)*h, y0 + double(0.5)*k2[0], y1 + double(0.5)*k2[1], y2 + double(0.5)*k2[2], y3 + double(0.5)*k3[3], alpha);
      }
 
      for (int j = 0; j < 4; ++j) {
         k4[j] = h*vfunc[j](t + h, y0 + k3[0], y1 + k3[1], y2 + k3[2], y3 + k3[3], alpha);
      }
 
      y0 += (k1[0] + double(2.) * k2[0] + double(2.) * k3[0] + k4[0]) / double(6.);
      y1 += (k1[1] + double(2.) * k2[1] + double(2.) * k3[1] + k4[1]) / double(6.);
      y2 += (k1[2] + double(2.) * k2[2] + double(2.) * k3[2] + k4[2]) / double(6.);
      y3 += (k1[3] + double(2.) * k2[3] + double(2.) * k3[3] + k4[3]) / double(6.);
 
      t = t + h;
   }
   
   result.emplace_back(t, y0, y1, y2, y3);
 
}
 
void foo() {
 
    double y_0, y_1, y_2, y_3, alpha;
 
    std::cout << "Input y_0: "; std::cin >> y_0; // 1e-10
    std::cout << "Input y_1: "; std::cin >> y_1; // 0
    std::cout << "Input y_2: "; std::cin >> y_2; // 0
    std::cout << "Input y_3: "; std::cin >> y_3; // 0
    std::cout << "Input alpha: "; std::cin >> alpha; //0.25
 
    double beg_time, max_time;
 
    std::cout << "Input beg_time: "; std::cin >> beg_time; // 0
    cout << "Input max_time: "; std::cin >> max_time; // 1.1e-8
 
    double step;
 
    cout << "Input step: "; std::cin >> step; // 1e-9
    
    vector<my_data> result;
    cout << "Runge-Kutta method: " << endl;
    rungeKutta(y_0, y_1, y_2, y_3, beg_time, max_time, step, alpha, result);
 
    double a, b, e, xmin;
    cout << "Input a: "; cin >> a;   // 8e-2
    cout << "Input b: "; cin >> b;   // 5e-1
    cout << "Input eps: "; cin >> e; // 1e-3
 
    cout << "Gold method: " << endl;
    Gold(a, b, e, xmin);
    cout << endl;
 
}
 
/******************************************************************************************************************/
 
int main(){
    foo();
 
    system("pause");
    return 0;
}

So we have this old project that was originally written in MSVC 6.0. The language standards are mostly C-based, although we’ve moved the project over to C++ v17 on VS2017. This project compiled just fine before the latest VS update.

After updating VS to 15.7.0 (and adding the Windows 10 SDK 10.0.17134), the project will still compile, but Intellisense drops hundreds of E0304 errors like the following:

Severity	Code	Source	        Description	
Error (active)	E0304	IntelliSense	no instance of function template "__countof_helper" matches the argument list	
  

Every single one of these calls (or at least every one I looked at) was calling
_countof like this snippet:

TCHAR ErrMsg[ERR_MSG_SIZE] = { (TCHAR)NULL };

...

FormatErrorString(GetLastError(), ErrMsg, _countof(ErrMsg), true);

If I try to «Show Error Help» on the error in the error list, it does nothing.

Has anyone else run into this or have some advice on why or how this has occurred?

Additionally, if it helps…

This project is:

— Targeting Windows 10 as a platform

— 10.0.17134.0 as the Windows SDK Version

— has 64-bit config (UNICODE defined) and 32-bit config (UNICODE
not
defined) profiles

— using «C++ 17 Standard» as the C++ Language Standard

— does not use MFC or CLR

I can include all the miscellaneous options if that helps, but I think that covers the major variables. Some of these options are intentional due to certain constraints in our software environment and/or integration requirements.

Thanks for any feedback.

Recommended Posts

bruce

Member

    • Report
    • Share

Hello friend, I am super beginner. I am trying to run this example code http://www.asic-world.com/systemc/first1.html#Counter_Design_Specs  counter design and counter testbench on my  systemc with visual studio. So I got two error. Here I put the error together.

  • Severity    Code    Description    Project    File    Line    Suppression State
    Error (active)    E0304    no instance of overloaded function «sc_start» matches the argument list    Project1    C:Users60182sourcereposProject1Project1first_counter_tb.cpp    17    
     
  • Severity    Code    Description    Project    File    Line    Suppression State
    Error    C2665    ‘sc_core::sc_start’: none of the 4 overloads could convert all the argument types    Project1    c:users60182sourcereposproject1project1first_counter_tb.cpp    17    
     

Capture.PNG

  • Quote

Link to comment
Share on other sites

Eyck

Advanced Member

    • Report
    • Share

The example you are refering to is for SystemC 2.0 and more over has errors. Actually this is a bad example to start with.

  • the sc_start() in line 17 needs to be commented out for 2 reasons: a) it doesn’t make any sense and b) it runs elaboration and tracing (VCD) needs to be initialized before that. After elaboration you cannot add signals for tracing anymore
  • sc_start() (lines 32, 34, 40, 42, 47, 49, 56 58) has to be called either without any arguments (so it runs to the end) or with a duration in terms of sc_time like this:

    sc_start(1, SC_NS);

My recommendation would be to either use  the Doulus tutorials: https://www.doulos.com/knowhow/systemc/tutorial/ or the stuff from SCLive (https://sclive.wordpress.com/)

  • maehne


  • Like


    1

  • Quote

Link to comment
Share on other sites

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.

<ns2:message name="MDIncrementalRefreshOrderBook47" id="47" description="MDIncrementalRefreshOrderBook" blockLength="11" semanticType="X" sinceVersion="9">
    <field name="TransactTime" id="60" type="uInt64" description="Start of event processing time in number of nanoseconds since Unix epoch" offset="0" semanticType="UTCTimestamp"/>
    <field name="MatchEventIndicator" id="5799" type="MatchEventIndicator" description="Bitmap field of eight Boolean type indicators reflecting the end of updates for a given Globex event" offset="8" semanticType="MultipleCharValue"/>
    <group name="NoMDEntries" id="268" description="Number of entries in Market Data message" blockLength="40" dimensionType="groupSize">
        <field name="OrderID" id="37" type="uInt64NULL" description="Order ID" offset="0" semanticType="int"/>
        <field name="MDOrderPriority" id="37707" type="uInt64NULL" description="Order priority for execution on the order book" offset="8" semanticType="int"/>
        <field name="MDEntryPx" id="270" type="PRICENULL9" description="Order price" offset="16" semanticType="Price"/>
        <field name="MDDisplayQty" id="37706" type="Int32NULL" description="Visible order qty" offset="24" semanticType="Qty"/>
        <field name="SecurityID" id="48" type="Int32" description="Security ID " offset="28" semanticType="int"/>
        <field name="MDUpdateAction" id="279" type="MDUpdateAction" description="Order book update action to be applied to the order referenced by OrderID" offset="32" semanticType="int"/>
        <field name="MDEntryType" id="269" type="MDEntryTypeBook" description="Market Data entry type " offset="33" semanticType="char"/>
    </group>
</ns2:message>

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Ошибка e000020 03a8 canon 3520i
  • Ошибка e030103 panasonic kx tda100 через компьютер usb