小编ada*_*ges的帖子

使用C跳转到代码中的特定行

很抱歉,如果这个问题很愚蠢,但我似乎无法在Google上找到答案.我有一段时间没有完成C编程,并且在我的生活中记得在C或C++中如何跳回(或转发)到代码中的特定行.如果我没记错的话,有办法做到这一点.

谢谢您的帮助!

干杯!

c c++

1
推荐指数
2
解决办法
4万
查看次数

gtkmm 2.4的良好文档

我有一个需要使用gtkmm 2.4 API的项目,但是它的文档很难找到.官方gtkmm网站有以下声明:

还提供旧版gtkmm 2 API的版本.

但是我似乎无法在任何地方找到它.有人知道一个地方获得文件的好地方吗?

c++ gnome gtkmm

1
推荐指数
1
解决办法
3201
查看次数

理解C:指针和结构

我正在努力更好地理解c,而我很难理解我在哪里使用*和&字符.而且只是结构一般.这是一些代码:

void word_not(lc3_word_t *R, lc3_word_t A) {
    int *ptr;
    *ptr = &R;
    &ptr[0] = 1;
    printf("this is R at spot 0: %d", ptr[0]);
}  
Run Code Online (Sandbox Code Playgroud)

lc3_word_t是一个像这样定义的结构:

struct lc3_word_t__ {
  BIT b15;
  BIT b14;
  BIT b13;
  BIT b12;
  BIT b11;
  BIT b10;
  BIT b9;
  BIT b8;
  BIT b7;
  BIT b6;
  BIT b5;
  BIT b4;
  BIT b3;
  BIT b2;
  BIT b1;
  BIT b0;
};
Run Code Online (Sandbox Code Playgroud)

这段代码没有做任何事情,它编译但是一旦我运行它我得到一个"分段错误"错误.我只是想了解如何读取和写入结构并使用指针.谢谢 :)


新守则:

void word_not(lc3_word_t *R, lc3_word_t A) {
    int* ptr;
    ptr = &R;
    ptr->b0 = 1;
    printf("this is: …
Run Code Online (Sandbox Code Playgroud)

c pointers data-structures

0
推荐指数
1
解决办法
1630
查看次数

我可以声明一个函数而不指定其中一个参数的类型吗?

可以像这样定义一个函数:

int foo(int temp1, int temp2 temp3) {
   ...
}
Run Code Online (Sandbox Code Playgroud)

特别是temp2temp3,会导致错误吗?如果没有,整体效果如何?

c syntax function

0
推荐指数
1
解决办法
108
查看次数

C++"undefined reference to ......"

我无法弄清楚为什么我的代码坏了,我可以使用一些帮助.

首先,代码:

Timer.h:

#include [...]

class Timer {
    public:
        [...]
        Timer operator+(double);
        [...]
    private:
        [...]
        void correctthedate(int day, int month, int year);
        [...]
};
Run Code Online (Sandbox Code Playgroud)

Timer.cc:

#include "Timer.h"
using namespace std;

[...]

void correctthedate(int day, int month, int year) {
    [...]
}

[...]

Timer Timer::operator+(double plush) {
    [...]
    correctthedate(curday, curmonth, curyear);
    return *this;
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译时,我收到错误:

Timer.o: In function `Timer::operator+(double)':
Timer.cc:(.text+0x1ad3): undefined reference to `Timer::correctthedate(int, int, int)'
Run Code Online (Sandbox Code Playgroud)

任何正确方向的指针?谢谢!

c++ compiler-errors

-1
推荐指数
2
解决办法
264
查看次数

标签 统计

c ×3

c++ ×3

compiler-errors ×1

data-structures ×1

function ×1

gnome ×1

gtkmm ×1

pointers ×1

syntax ×1