我正在尝试使用GCC(linux)和makefile来编译我的项目.
我得到以下错误,在这种情况下似乎无法破译:
"No rule to make target 'vertex.cpp', needed by 'vertex.o'. Stop."
Run Code Online (Sandbox Code Playgroud)
这是makefile:
a.out: vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o
g++ vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o
main.o: main.cpp main.h
g++ -c main.cpp
vertex.o: vertex.cpp vertex.h
g++ -c vertex.cpp
edge.o: edge.cpp edge.h
g++ -c num.cpp
vlist.o: vlist.cpp vlist.h
g++ -c vlist.cpp
elist.o: elist.cpp elist.h
g++ -c elist.cpp
vnode.o: vnode.cpp vnode.h
g++ -c vnode.cpp
enode.o: enode.cpp enode.h
g++ -c node.cpp
Run Code Online (Sandbox Code Playgroud) 我刚刚继承了一些C++代码,这些代码写得不好用一个cpp文件,其中包含main和一堆其他函数.还有一些.h文件包含类及其函数定义.
到目前为止,该程序是使用该命令编译的g++ main.cpp.现在我已经将类.h和.cpp文件分开了,我需要使用makefile还是我仍然可以使用g++ main.cpp命令?
可能重复:
如何为Java程序创建.exe?
我刚刚用eclipse创建了一个简单的程序,我想将它编译成可执行文件,但似乎无法找到如何做到这一点.请帮忙.
我开始用Java编程,我想知道是否#define存在与C++相当的东西.
谷歌的快速搜索说它没有,但任何人都可以告诉我,如果Java中存在类似的东西吗?我正在努力让我的代码更具可读性.
而不是myArray[0]我想能够写myArray[PROTEINS]例如.
我需要确保我的代码中没有任何行超过一定的长度.
通常我会在有逗号或其他合适的中断的地方分隔.
如何将此行分为2行?
cout<<"Error:This is a really long error message that exceeds the maximum permitted length.\n";
Run Code Online (Sandbox Code Playgroud)
如果我只是在中间某处按下输入它就不起作用了.
我正在尝试用C++创建一个临时文本文件,然后在程序结束时删除它.我没跟谷歌好运.
你能告诉我使用哪些功能吗?
下面的答案告诉我如何创建临时文件.如果我只是想创建一个文件(tmp.txt)然后将其删除怎么办?我该怎么办?
我正在尝试编写一个函数,它获取两个数组,另一个函数的名称作为参数.
例如
main.m:
x=[0 0.2 0.4 0.6 0.8 1.0];
y=[0 0.2 0.4 0.6 0.8 1.0];
func2(x,y,'func2eq')
func 2.m :
function t =func2(x, y, z, 'func') //"unexpected matlab expression" error message here
t= func(x,y,z);
func2eq.m:
function z= func2eq(x,y)
z= x + sin(pi * x)* exp(y);
Run Code Online (Sandbox Code Playgroud)
Matlab告诉我上面的错误信息.我之前从未传递过函数名作为参数.我哪里错了?
当我在模板类中编写函数时,如何找出我的T是什么?
例如
template <typename T>
ostream& operator << (ostream &out,Vector<T>& vec)
{
if (typename T == int)
}
Run Code Online (Sandbox Code Playgroud)
如何编写上面的if语句以便它可以工作?
When someone refers to a relation in a database course, what does that mean?
如何在while不进入块结束的情况下立即退出循环?
例如,
while (choice != 99)
{
cin >> choice;
if (choice == 99)
//Exit here and don't get additional input
cin>>gNum;
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
c++ ×5
compilation ×2
java ×2
makefile ×2
break ×1
database ×1
executable ×1
file ×1
function ×1
gcc ×1
header ×1
matlab ×1
preprocessor ×1
split ×1
templates ×1
while-loop ×1