Note that there are some explanatory texts on larger screens.

plurals
  1. POUncalled function causes error
    primarykey
    data
    text
    <p>I'm having trouble resolving this issue around my vectors and strings. I've created a class for reading shaders (OpenGL), but currently not using it anywhere within my program. The problem is when I test my application, I still get an error. The function where I've narrowed down the error is below and if I comment-out the the lines, my application runs as expected (uncommenting lines in relation to <code>sProgram</code> causes error:</p> <pre><code>#define FOR(q, n) for (int q = 0; q &lt; n; q++) #define SFOR(q, s, e) for (int q = s; q &lt;= e; q++) #define RFOR(q, n) for (int q = n; q &gt;= 0; q--) #define RSFOR(q, s, e) for (int q = s; q &gt;= e; q--) #define ESZ(elem) (int)elem.size() ... ... bool GLShader::LoadShader(string sFile, int a_iType) { FILE* fp = fopen(sFile.c_str(), "rt"); if (!fp) return false; // Get all lines from a file vector&lt;string&gt; sLines; char sLine[255]; while (fgets(sLine, 255, fp)) sLines.push_back(sLine); fclose(fp); // const char** sProgram = new const char*[ESZ(sLines)]; &lt;--- problem with sProgram // FOR(i, ESZ(sLines))sProgram[i] = sLines[i].c_str(); uiShader = glCreateShader(a_iType); // glShaderSource(uiShader, ESZ(sLines), sProgram, NULL); glCompileShader(uiShader); // delete[] sProgram; &lt;--- Error int iCompilationStatus; glGetShaderiv(uiShader, GL_COMPILE_STATUS, &amp;iCompilationStatus); if (iCompilationStatus == GL_FALSE) return false; iType = a_iType; bLoaded = true; return 1; } </code></pre> <p>This is the error I received:</p> <pre><code>Error 1 error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &amp; __thiscall std::vector&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;, class std::allocator&lt;char&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt; &gt;::operator[](unsigned int)" (??A?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V? $allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std @@@2@@std@@QAEAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@I@Z) c:\Users\Me\documents\visual studio 2013\Projects\FooV1\FooV1\Bar.obj </code></pre> <p>And in the output:</p> <pre><code>1&gt;------ Build started: Project: FooV1, Configuration: Debug Win32 ------ 1&gt; main.cpp 1&gt;Bar.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &amp; __thiscall std::vector&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt; &gt;::operator[](unsigned int)" (??A?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator @D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V? $allocator@D@2@@std@@@2@@std@@QAEAAV?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@1@I@Z) 1&gt;c:\users\Me\documents\visual studio 2013\Projects\FooV1\Debug\FooV1.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload