我安装了c++6.0,结果在目录中改了文件安装路径,结果编译时出错,说找不到文件,我重装了几次,都安装失败

我安装了c++6.0,结果在目录中改了文件安装路径,结果编译时出错,说找不到文件,我重装了几次,都安装失败,第1张

在“工具——选项——目录”里设置:

executatble files(可执行文件):

D:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin

D:\Program Files\Microsoft Visual Studio\VC98\BIN

D:\Program Files\Microsoft Visual Studio\Common\TOOLS

D:\Program Files\Microsoft Visual Studio\Common\TOOLS\WINNT

注——以下资源路径为可选添加:

C:\windows\system32\wbem

C:\windows\system32

include files:

D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE

D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE

D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE

library files:

D:\Program Files\Microsoft Visual Studio\VC98\LIB

D:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB

source files:

D:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC

D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE

D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE

D:\Program Files\Microsoft Visual Studio\VC98\CRT\SRC

可以试一试!

帮你修改了一下,编译运行没问题,修改的地方都标出来了,

由于不知道你程序的功能,所以没有对你的程序逻辑进行分析

#include <stdio.h>

#include<pthread.h>

#include<semaphore.h>

#include<unistd.h>

//----------------以下是修改的部分

sem_t in

sem_t out

sem_t handout

sem_t handin

sem_t goout

//----------------

int counter=0

void * studentIn(void *a)

{

sem_wait(&in)//修改

counter++

printf("%d\n",counter)

if(counter==30)

{

sem_post(&handout)//修改

return NULL

}

sem_post(&in)//修改

return NULL

}

void * fteacherhandout(void *b)

{

sem_wait(&handout)//修改

printf("teacher said:hand out over\n")

sem_post(&handin)//修改

return NULL

}

void * studentout(void *c)

{

sem_wait(&handin)//修改

sem_wait(&out)//修改

counter--

printf("%d\n",counter)

if(counter==0)

{

sem_post(&goout)//修改

return NULL

}

sem_post(&out)//修改

}

void * fteacherout(void *d)

{

sem_wait(&goout)//修改

printf("teacher go out")

return NULL

}

void main()

{

int i=0

//----------------以下是修改的部分

sem_init(&in,0,1)

sem_init(&out,0,1)

sem_init(&handin,0,0)

sem_init(&handout,0,0)

sem_init(&goout,0,0)

//----------------

pthread_t thread1[30],thread2[30],teacher1,teacher2

pthread_attr_t attr

pthread_attr_init(&attr)

for(i=0i<30i++)

{

pthread_create(&thread1[i],&attr,studentIn,NULL)

}

for(i=0i<30i++)

{

pthread_create(&thread2[i],&attr,studentout,NULL)

}

pthread_create(&teacher1,&attr,fteacherhandout,NULL)

pthread_create(&teacher2,&attr,fteacherout,NULL)

return

}


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/388750.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存