我不知道为什么会这样; 一些谷歌搜索让我相信它是由于不正确的内存管理,而其他人则说这是因为链接到可执行文件的无效.DLL.我似乎无法解决这个问题,因为我能想到的唯一.DLL是无效的.我的freeglut .DLL,但它本身没有任何问题.
我要做的就是创建一个窗口.
题
我的代码发生了什么?我做错了什么,我该如何解决?
码
WinMain
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
bool done;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszClassName = L"someclass";
if (!RegisterClassEx(&wc)) { //Error:
MessageBox(NULL, L"Class registration has failed!", L"Error!", MB_OK | MB_ICONINFORMATION);
return 0;
}
hwnd = …Run Code Online (Sandbox Code Playgroud) 我正在编写代码来读写文本文件.但是当我运行我的代码时,我收到了一个SIGSEGV运行时错误.我需要帮助搞清楚代码有什么问题.
#include <stdio.h>
#include <stdlib.h>
int main(){
/*Variable for writing to file */
char *name[] = {"Raju", "Nayan", "Hanif"};
char *id[] = {"100", "101", "102"};
float cgpa[] = {3.50, 5.00, 4.00};
/*Variable for reading from file*/
char *getname, *getid;
float getcgpa;
int i;
FILE *fp;
fp = fopen("f:\\raju.nog", "w"); /*Create new file */
for(i=0; i<5; i++){
fprintf(fp, "%-10s%-10s%-1.2f\n", name[i], id[i], cgpa[i]); /*write to file*/
}
fclose(fp);
/*read from file and print to screen*/
fp = fopen("f:\\raju.nog", "r");
while(fscanf(fp, "%s %s …Run Code Online (Sandbox Code Playgroud) 我的Python脚本的用户说他们得到以下错误:
Traceback (most recent call last):
File "MCManager.py", line 7, in <module>
os.chdir(os.path.dirname(__file__))
OSError: [Errno 2] No such file or directory: ''
Run Code Online (Sandbox Code Playgroud)
脚本所在的目录怎么可能不存在?这是兼容性问题吗?我使用与错误相同的操作系统和版本,并且无法复制此操作.
我试图用MySql数据填充JTable.事情是当我运行Login类时,我收到消息"java.SQLException:没有为参数2指定值",当我运行JTable类时,我一直收到java.lang.NullPointerException错误.我有三个类:1 - 连接到DB:
import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
public class javaconnect {
Connection conn = null;
public static Connection ConnecrDB() {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/mydb",
"root", "root");
JOptionPane.showMessageDialog(null, "Connected");
return con;
} catch (Exception e) {
System.out.println("ERROR: " + e.getMessage());
}
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
第二类是登录框架:
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import …Run Code Online (Sandbox Code Playgroud) 根据我的说法,以下代码应该成功运行,但在运行时失败.我没有得到原因:
void main()
{
int arr[5][3]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int *m=arr[0];
int **p=&m;
p=p+1;
printf("%d",**p);
}
Run Code Online (Sandbox Code Playgroud)
a.exe在gcc编译器,Windows 7 64位运行时已停止运行
python新手再来一次,
我试图重复删除列表的最后一个条目,直到它返回某个字符.但是尝试运行脚本我得到"IndexError:从空列表中弹出".所以whileList不包含在while循环中?
码:
theList = list("abc/123")
popStop = ""
popped = ""
while popStop != "/":
if theList.pop() != "/":
popped = popped + str(theList.pop())
else:
popStop = "/"
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助.
我正在运行一个Java程序,它将BufferedReader输入解析为分隔的字符串以输出到文件.成功从源文件中读取24行并将其保存到目标文件后,我收到与"读取文件的下一行"配对的3(使用getMessage())方法的错误消息.catchtry
当我将捕获更改为以下内容时,
catch (Exception e)
{
System.err.println("Error: " + e.getMessage().getClass().getName());
}
Run Code Online (Sandbox Code Playgroud)
被退回的catch结果Error: java.lang.String......但没有进一步的解释.文件中的错误字符?不正确的铸造?OutOfBounds作为另一条评论建议?任何其他想法如何从此错误中提取更多信息?
我已经在十六进制编辑器中查看了输入文件,并且行之间没有意外的EOF或空字符,输入数据在十六进制或文本编辑器中按预期显示,我找不到任何有关如何解释3错误消息的文档,甚至如何确定它是OS还是Java异常.
我收到System.Windows.Forms.dll中出现的'System.TypeLoadException'.这是错误消息的其余部分.
附加信息:无法从程序集'DataTeamMailerCSharp,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'加载类型'DataTeamMailerCSharp.NewReport',因为方法'.ctor'没有实现(没有RVA).
这是正在发生的课程.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DataTeamMailerCSharp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new mainGUI());
}
}
}
Run Code Online (Sandbox Code Playgroud)
错误发生在这里:
Application.Run(new mainGUI());
Run Code Online (Sandbox Code Playgroud)
在回复评论时,我最近在我的一个课程中改变了这一点.我正在尝试XML序列化,并且在无参数构造函数中它告诉我它需要一个body或exter,partial和其他东西.这是类代码.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataTeamMailerCSharp
{
[Serializable] class NewPerson
{
public string personName { get; set; }
public string …Run Code Online (Sandbox Code Playgroud) 有些东西对我来说没有意义.为什么这样:
public static int[] countNumbers(String n){
int[] counts = new int[10];
for (int i = 0; i < n.length(); i++){
if (Character.isDigit(n.charAt(i)))
counts[n.charAt(i)]++;
}
return counts;
}
Run Code Online (Sandbox Code Playgroud)
在此时出现ArrayOutOfBounds错误:
public static int[] countNumbers(String n){
int[] counts = new int[10];
for (int i = 0; i < n.length(); i++){
if (Character.isDigit(n.charAt(i)))
counts[n.charAt(i) - '0']++;
}
return counts;
}
Run Code Online (Sandbox Code Playgroud)
才不是?两个示例之间的唯一区别是在第二个示例中计数的索引被减去零.如果我没有错,那么第一个示例是否应该正确显示,因为正在检查相同的值?
以下是两种方法传递的值:
System.out.print("Enter a string: ");
String phone = input.nextLine();
//Array that invokes the count letter method
int[] letters = countLetters(phone.toLowerCase());
//Array that invokes …Run Code Online (Sandbox Code Playgroud) 我仍然是Qt的新手,我最近一直在做一个大型项目.当我尝试运行该项目时,我收到此错误:
ASSERT failure in QList<T>::at: "index out of range", file c:\qt\qt5.3.0\5.3\msvc2013_64\include\qtcore\qlist.h, line 479
Run Code Online (Sandbox Code Playgroud)
只是想知道是否有人知道这意味着什么或我如何追查问题的根源?
[编辑]我认为添加此代码会导致错误
autAtom *aP = new autAtom(Principal);
autAtom *aQ = new autAtom(Principal);
autData *P = new autData (DataAtom, aP);
autData *Q = new autData (DataAtom, aQ);
autData *X = new autData (AnyData);
AUTPostulate *p;
autStatementList preList;
{
preList.clear();
//autData *d1 = new autData(NotHereData, X);
autStatement *pre1 = new autStatement(aP, believes, X);
autStatement *goal = new autStatement(aP, sees, X);
preList.append(pre1);
p = new AUTPostulate("BS", BS, goal, preList);
cout …Run Code Online (Sandbox Code Playgroud) runtime-error ×10
java ×3
c ×2
c++ ×2
python ×2
.net ×1
arrays ×1
c# ×1
jtable ×1
mysql ×1
qt ×1
swing ×1
visual-c++ ×1
while-loop ×1
winapi ×1